mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
drivers/video/backlight/lcd.c: call put_device if device_register fails
Currently we kfree the container of the device which failed to register. This is wrong as the last reference is not given up with a put_device call. Also, now that we have put_device() callen, we no longer need the kfree as the new_ld->dev.release function will take care of kfreeing the associated memory. Signed-off-by: Levente Kurusa <levex@linux.com> Acked-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
07bacb3826
commit
54f5968db9
1 changed files with 1 additions and 1 deletions
|
@ -228,7 +228,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
|
||||||
|
|
||||||
rc = device_register(&new_ld->dev);
|
rc = device_register(&new_ld->dev);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
kfree(new_ld);
|
put_device(&new_ld->dev);
|
||||||
return ERR_PTR(rc);
|
return ERR_PTR(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue