All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/tegra: submit: No need for Null pointer check before kfree
@ 2022-12-27 17:14 ` Deepak R Varma
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak R Varma @ 2022-12-27 17:14 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter,
	dri-devel, linux-tegra, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar, Deepak R Varma

kfree() & vfree() internally perform 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/drm/tegra/submit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tegra/submit.c b/drivers/gpu/drm/tegra/submit.c
index 066f88564169..06f836db99d0 100644
--- a/drivers/gpu/drm/tegra/submit.c
+++ b/drivers/gpu/drm/tegra/submit.c
@@ -680,8 +680,8 @@ int tegra_drm_ioctl_channel_submit(struct drm_device *drm, void *data,
 		kfree(job_data->used_mappings);
 	}

-	if (job_data)
-		kfree(job_data);
+	kfree(job_data);
+
 put_bo:
 	gather_bo_put(&bo->base);
 unlock:
--
2.34.1




^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-01-22 18:18 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27 17:14 [PATCH] drm/tegra: submit: No need for Null pointer check before kfree Deepak R Varma
2022-12-27 17:14 ` Deepak R Varma
2022-12-28 12:28 ` Mikko Perttunen
2022-12-28 12:28   ` Mikko Perttunen
2022-12-28 13:08   ` Deepak R Varma
2022-12-28 13:08     ` Deepak R Varma
2022-12-28 13:17     ` Mikko Perttunen
2022-12-28 13:17       ` Mikko Perttunen
2022-12-28 13:34       ` Deepak R Varma
2022-12-28 13:34         ` Deepak R Varma
2022-12-28 13:48         ` Mikko Perttunen
2022-12-28 13:48           ` Mikko Perttunen
2022-12-28 14:18           ` Deepak R Varma
2022-12-28 14:18             ` Deepak R Varma
2022-12-30  9:15       ` Stanislaw Gruszka
2022-12-30  9:15         ` Stanislaw Gruszka
2022-12-30 10:01         ` Mikko Perttunen
2022-12-30 10:01           ` Mikko Perttunen
2022-12-30 10:03           ` Mikko Perttunen
2022-12-30 10:03             ` Mikko Perttunen
2023-01-02 18:20             ` Deepak R Varma
2023-01-02 18:20               ` Deepak R Varma
2023-01-22 18:18               ` Deepak R Varma
2023-01-22 18:18                 ` Deepak R Varma
2022-12-30 10:15           ` Stanislaw Gruszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.