Commit b4a11d3d authored by Akinobu Mita's avatar Akinobu Mita Committed by Richard Purdie

backlight: crbllcd_bl - Use platform_device_register_simple()

Use platform_device_register_simple() and also fix error
handling when platform_device_alloc() fails (cr_backlight_driver
is left registered).
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent 6cd6f35a
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment