Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Akinobu Mita and committed by
Richard Purdie
b4a11d3d 6cd6f35a

+7 -11
+7 -11
drivers/video/backlight/cr_bllcd.c
··· 259 259 { 260 260 int ret = platform_driver_register(&cr_backlight_driver); 261 261 262 - if (!ret) { 263 - crp = platform_device_alloc("cr_backlight", -1); 264 - if (!crp) 265 - return -ENOMEM; 262 + if (ret) 263 + return ret; 266 264 267 - ret = platform_device_add(crp); 268 - 269 - if (ret) { 270 - platform_device_put(crp); 271 - platform_driver_unregister(&cr_backlight_driver); 272 - } 265 + crp = platform_device_register_simple("cr_backlight", -1, NULL, 0); 266 + if (IS_ERR(crp)) { 267 + platform_driver_unregister(&cr_backlight_driver); 268 + return PTR_ERR(crp); 273 269 } 274 270 275 271 printk("Carillo Ranch Backlight Driver Initialized.\n"); 276 272 277 - return ret; 273 + return 0; 278 274 } 279 275 280 276 static void __exit cr_backlight_exit(void)