Skip to content

Commit

Permalink
backlight: crbllcd_bl - Use platform_device_register_simple()
Browse files Browse the repository at this point in the history
Use platform_device_register_simple() and also fix error
handling when platform_device_alloc() fails (cr_backlight_driver
is left registered).

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
  • Loading branch information
Akinobu Mita authored and Richard Purdie committed Jan 8, 2009
1 parent 6cd6f35 commit b4a11d3
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions drivers/video/backlight/cr_bllcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,18 @@ static int __init cr_backlight_init(void)
{
int ret = platform_driver_register(&cr_backlight_driver);

if (!ret) {
crp = platform_device_alloc("cr_backlight", -1);
if (!crp)
return -ENOMEM;
if (ret)
return ret;

ret = platform_device_add(crp);

if (ret) {
platform_device_put(crp);
platform_driver_unregister(&cr_backlight_driver);
}
crp = platform_device_register_simple("cr_backlight", -1, NULL, 0);
if (IS_ERR(crp)) {
platform_driver_unregister(&cr_backlight_driver);
return PTR_ERR(crp);
}

printk("Carillo Ranch Backlight Driver Initialized.\n");

return ret;
return 0;
}

static void __exit cr_backlight_exit(void)
Expand Down

0 comments on commit b4a11d3

Please sign in to comment.