Commit 452d5e29 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Guenter Roeck

hwmon: (nct6775) Drop duplicate NULL check in ->init() and ->exit()

Since platform_device_unregister() is NULL-aware, we don't need to duplicate
this check. Remove it and fold the rest of the code.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarZev Weiss <zev@bewilderbeest.net>
Link: https://lore.kernel.org/r/20220610103324.87483-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 0356d778
......@@ -1200,10 +1200,8 @@ static int __init sensors_nct6775_platform_init(void)
exit_device_put:
platform_device_put(pdev[i]);
exit_device_unregister:
while (--i >= 0) {
if (pdev[i])
platform_device_unregister(pdev[i]);
}
while (i--)
platform_device_unregister(pdev[i]);
exit_unregister:
platform_driver_unregister(&nct6775_driver);
return err;
......@@ -1213,10 +1211,8 @@ static void __exit sensors_nct6775_platform_exit(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(pdev); i++) {
if (pdev[i])
platform_device_unregister(pdev[i]);
}
for (i = 0; i < ARRAY_SIZE(pdev); i++)
platform_device_unregister(pdev[i]);
platform_driver_unregister(&nct6775_driver);
}
......
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