backlight: core: Replace kfree with put_device
authorLevente Kurusa <levex@linux.com>
Fri, 7 Feb 2014 08:43:21 +0000 (09:43 +0100)
committerLee Jones <lee.jones@linaro.org>
Tue, 8 Apr 2014 12:20:39 +0000 (13:20 +0100)
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 <levex@linux.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/backlight.c

index 5d05555fe841d2a4eaac7d230e498e0c51f5d841..20b276e1f894465a140165c2f90a44f479e37597 100644 (file)
@@ -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);
        }