Thread (5 messages) 5 messages, 4 authors, 2014-02-10

Re: [PATCH] backlight: replace kfree with put_device

From: Jingoo Han <hidden>
Date: 2014-02-10 00:22:49
Also in: lkml

On Friday, February 07, 2014 5:43 PM, Levente Kurusa wrote:
As per the comments on device_register, we shouldn't call kfree()
right after a device_register() failure. Instead call put_device(),
which in turn will call bl_device_release resulting in a kfree to the
full structure.

Signed-off-by: Levente Kurusa <redacted>
(+cc Bryan Wu, Lee Jones)

Acked-by: Jingoo Han <redacted>

Best regards,
Jingoo Han
quoted hunk ↗ jump to hunk
---
 drivers/video/backlight/backlight.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 5d05555..20b276e 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -333,7 +333,7 @@ struct backlight_device *backlight_device_register(const char *name,

 	rc = device_register(&new_bd->dev);
 	if (rc) {
-		kfree(new_bd);
+		put_device(&new_bd->dev);
 		return ERR_PTR(rc);
 	}

--
1.8.3.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help