From 35762a47c0a24072a689cbd98ecf8c62b037ef8a Mon Sep 17 00:00:00 2001 From: Levente Kurusa Date: Fri, 7 Feb 2014 09:43:21 +0100 Subject: backlight: core: Replace kfree with put_device 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 Acked-by: Jingoo Han Signed-off-by: Lee Jones --- drivers/video/backlight/backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video/backlight/backlight.c') 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); } -- cgit v1.1