mirror of https://gitee.com/openkylin/linux.git
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: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
6cd6f35a4b
commit
b4a11d3da2
|
@ -259,22 +259,18 @@ static int __init cr_backlight_init(void)
|
||||||
{
|
{
|
||||||
int ret = platform_driver_register(&cr_backlight_driver);
|
int ret = platform_driver_register(&cr_backlight_driver);
|
||||||
|
|
||||||
if (!ret) {
|
if (ret)
|
||||||
crp = platform_device_alloc("cr_backlight", -1);
|
return ret;
|
||||||
if (!crp)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
ret = platform_device_add(crp);
|
crp = platform_device_register_simple("cr_backlight", -1, NULL, 0);
|
||||||
|
if (IS_ERR(crp)) {
|
||||||
if (ret) {
|
platform_driver_unregister(&cr_backlight_driver);
|
||||||
platform_device_put(crp);
|
return PTR_ERR(crp);
|
||||||
platform_driver_unregister(&cr_backlight_driver);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("Carillo Ranch Backlight Driver Initialized.\n");
|
printk("Carillo Ranch Backlight Driver Initialized.\n");
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit cr_backlight_exit(void)
|
static void __exit cr_backlight_exit(void)
|
||||||
|
|
Loading…
Reference in New Issue