linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpu: host1x: No need for Null pointer check before kfree
@ 2022-12-27 18:47 Deepak R Varma
  0 siblings, 0 replies; only message in thread
From: Deepak R Varma @ 2022-12-27 18:47 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, dri-devel,
	linux-tegra, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar, Deepak R Varma

kfree() & vfree() internally performs NULL check on the pointer handed
to it and take no action if it indeed is NULL. Hence there is no need
for a pre-check of the memory pointer before handing it to
kfree()/vfree().

Issue reported by ifnullfree.cocci Coccinelle semantic patch script.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/gpu/host1x/fence.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/host1x/fence.c b/drivers/gpu/host1x/fence.c
index df428bcbae69..42498902947f 100644
--- a/drivers/gpu/host1x/fence.c
+++ b/drivers/gpu/host1x/fence.c
@@ -93,8 +93,7 @@ static void host1x_syncpt_fence_release(struct dma_fence *f)
 {
 	struct host1x_syncpt_fence *sf = to_host1x_fence(f);

-	if (sf->waiter)
-		kfree(sf->waiter);
+	kfree(sf->waiter);

 	dma_fence_free(f);
 }
--
2.34.1




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-27 18:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-27 18:47 [PATCH] gpu: host1x: No need for Null pointer check before kfree Deepak R Varma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).