linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: vc04_services: vchiq_bus: Do not kfree device
@ 2023-10-09  6:09 Umang Jain
  2023-10-09 10:16 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Umang Jain @ 2023-10-09  6:09 UTC (permalink / raw)
  To: linux-staging, linux-media, linux-rpi-kernel
  Cc: Stefan Wahren, Greg Kroah-Hartman, Dave Stevenson, Umang Jain

As per device_register() documentation, this kfree() on error path will
crash. The call to put_device() is all that is needed here to free the
memory.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
index 4ac3491efe45..0076d091b9b2 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
@@ -73,7 +73,6 @@ vchiq_device_register(struct device *parent, const char *name)
 	if (ret) {
 		dev_err(parent, "Cannot register %s: %d\n", name, ret);
 		put_device(&device->dev);
-		kfree(device);
 		return NULL;
 	}
 
-- 
2.40.1


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

* Re: [PATCH] staging: vc04_services: vchiq_bus: Do not kfree device
  2023-10-09  6:09 [PATCH] staging: vc04_services: vchiq_bus: Do not kfree device Umang Jain
@ 2023-10-09 10:16 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-09 10:16 UTC (permalink / raw)
  To: Umang Jain
  Cc: linux-staging, linux-media, linux-rpi-kernel, Stefan Wahren,
	Dave Stevenson

On Mon, Oct 09, 2023 at 11:39:06AM +0530, Umang Jain wrote:
> As per device_register() documentation, this kfree() on error path will
> crash. The call to put_device() is all that is needed here to free the
> memory.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c | 1 -
>  1 file changed, 1 deletion(-)

This needs a "Fixes:" tag, right?

thanks,

greg k-h

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

end of thread, other threads:[~2023-10-09 10:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09  6:09 [PATCH] staging: vc04_services: vchiq_bus: Do not kfree device Umang Jain
2023-10-09 10:16 ` Greg Kroah-Hartman

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).