Skip to content

Commit

Permalink
drivers/video/backlight/lcd.c: call put_device if device_register fails
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
levex authored and torvalds committed Jan 31, 2014
1 parent 07bacb3 commit 54f5968
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/video/backlight/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,

rc = device_register(&new_ld->dev);
if (rc) {
kfree(new_ld);
put_device(&new_ld->dev);
return ERR_PTR(rc);
}

Expand Down

0 comments on commit 54f5968

Please sign in to comment.