Commit 6cd6f35a authored by Akinobu Mita's avatar Akinobu Mita Committed by Richard Purdie

backlight: progear_bl - Use platform_device_register_simple()

Use platform_device_register_simple() and also fix error
handling when platform_device_alloc() fails (progearbl_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 3bcdcc0e
...@@ -119,20 +119,16 @@ static int __init progearbl_init(void) ...@@ -119,20 +119,16 @@ static int __init progearbl_init(void)
{ {
int ret = platform_driver_register(&progearbl_driver); int ret = platform_driver_register(&progearbl_driver);
if (!ret) { if (ret)
progearbl_device = platform_device_alloc("progear-bl", -1); return ret;
if (!progearbl_device) progearbl_device = platform_device_register_simple("progear-bl", -1,
return -ENOMEM; NULL, 0);
if (IS_ERR(progearbl_device)) {
ret = platform_device_add(progearbl_device);
if (ret) {
platform_device_put(progearbl_device);
platform_driver_unregister(&progearbl_driver); platform_driver_unregister(&progearbl_driver);
} return PTR_ERR(progearbl_device);
} }
return ret; return 0;
} }
static void __exit progearbl_exit(void) static void __exit progearbl_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