Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -119,20 +119,16 @@ static int __init progearbl_init(void)
{
	int ret = platform_driver_register(&progearbl_driver);

	if (!ret) {
		progearbl_device = platform_device_alloc("progear-bl", -1);
		if (!progearbl_device)
			return -ENOMEM;

		ret = platform_device_add(progearbl_device);

		if (ret) {
			platform_device_put(progearbl_device);
	if (ret)
		return ret;
	progearbl_device = platform_device_register_simple("progear-bl", -1,
								NULL, 0);
	if (IS_ERR(progearbl_device)) {
		platform_driver_unregister(&progearbl_driver);
		}
		return PTR_ERR(progearbl_device);
	}

	return ret;
	return 0;
}

static void __exit progearbl_exit(void)