Thread (6 messages) read the whole thread 6 messages, 3 authors, 2018-12-11
STALE2791d

[PATCH] ocxl: Simplify free_spa()

From: Greg Kurz <hidden>
Date: 2018-12-10 15:32:24
Also in: stable
Subsystem: char and misc drivers, ocxl (open coherent accelerator processor interface opencapi) driver, the rest · Maintainers: Arnd Bergmann, Greg Kroah-Hartman, Mahesh J Salgaonkar, Linus Torvalds

The only users of free_spa() are alloc_link() and free_link(), and
in both cases:

- link->spa != NULL

- free_spa(link) is immediatly followed by kfree(link)

The check isn't needed, and it doesn't bring much to clear the link->spa
pointer. Drop both.

Signed-off-by: Greg Kurz <redacted>
---
 drivers/misc/ocxl/link.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c
index 31695a078485..eed92055184d 100644
--- a/drivers/misc/ocxl/link.c
+++ b/drivers/misc/ocxl/link.c
@@ -352,11 +352,8 @@ static void free_spa(struct link *link)
 	pr_debug("Freeing SPA for %x:%x:%x\n", link->domain, link->bus,
 		link->dev);
 
-	if (spa && spa->spa_mem) {
-		free_pages((unsigned long) spa->spa_mem, spa->spa_order);
-		kfree(spa);
-		link->spa = NULL;
-	}
+	free_pages((unsigned long) spa->spa_mem, spa->spa_order);
+	kfree(spa);
 }
 
 static int alloc_link(struct pci_dev *dev, int PE_mask, struct link **out_link)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help