Skip to content

Commit 54f5968

Browse files
levextorvalds
authored andcommitted
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>
1 parent 07bacb3 commit 54f5968

File tree

1 file changed

+1
-1
lines changed
  • drivers/video/backlight

1 file changed

+1
-1
lines changed

drivers/video/backlight/lcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
228228

229229
rc = device_register(&new_ld->dev);
230230
if (rc) {
231-
kfree(new_ld);
231+
put_device(&new_ld->dev);
232232
return ERR_PTR(rc);
233233
}
234234

0 commit comments

Comments
 (0)