Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <levex@linux.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Levente Kurusa and committed by
Lee Jones
35762a47 fa389e22

+1 -1
+1 -1
drivers/video/backlight/backlight.c
··· 333 333 334 334 rc = device_register(&new_bd->dev); 335 335 if (rc) { 336 - kfree(new_bd); 336 + put_device(&new_bd->dev); 337 337 return ERR_PTR(rc); 338 338 } 339 339