@@ -45,15 +45,15 @@ static int simatic_ipc_leds_gpio_apollolake_probe(struct platform_device *pdev)
&simatic_ipc_led_gpio_table_extra);
}
-static int simatic_ipc_leds_gpio_apollolake_remove(struct platform_device *pdev)
+static void simatic_ipc_leds_gpio_apollolake_remove(struct platform_device *pdev)
{
- return simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table,
- &simatic_ipc_led_gpio_table_extra);
+ simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table,
+ &simatic_ipc_led_gpio_table_extra);
}
static struct platform_driver simatic_ipc_led_gpio_apollolake_driver = {
.probe = simatic_ipc_leds_gpio_apollolake_probe,
- .remove = simatic_ipc_leds_gpio_apollolake_remove,
+ .remove_new = simatic_ipc_leds_gpio_apollolake_remove,
.driver = {
.name = KBUILD_MODNAME,
},
@@ -33,15 +33,13 @@ static const struct gpio_led_platform_data simatic_ipc_gpio_leds_pdata = {
.leds = simatic_ipc_gpio_leds,
};
-int simatic_ipc_leds_gpio_remove(struct platform_device *pdev,
+void simatic_ipc_leds_gpio_remove(struct platform_device *pdev,
struct gpiod_lookup_table *table,
struct gpiod_lookup_table *table_extra)
{
gpiod_remove_lookup_table(table);
gpiod_remove_lookup_table(table_extra);
platform_device_unregister(simatic_leds_pdev);
-
- return 0;
}
EXPORT_SYMBOL_GPL(simatic_ipc_leds_gpio_remove);
@@ -36,15 +36,14 @@ static int simatic_ipc_leds_gpio_elkhartlake_probe(struct platform_device *pdev)
NULL);
}
-static int simatic_ipc_leds_gpio_elkhartlake_remove(struct platform_device *pdev)
+static void simatic_ipc_leds_gpio_elkhartlake_remove(struct platform_device *pdev)
{
- return simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table,
- NULL);
+ simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table, NULL);
}
static struct platform_driver simatic_ipc_led_gpio_elkhartlake_driver = {
.probe = simatic_ipc_leds_gpio_elkhartlake_probe,
- .remove = simatic_ipc_leds_gpio_elkhartlake_remove,
+ .remove_new = simatic_ipc_leds_gpio_elkhartlake_remove,
.driver = {
.name = KBUILD_MODNAME,
},
@@ -45,15 +45,15 @@ static int simatic_ipc_leds_gpio_f7188x_probe(struct platform_device *pdev)
&simatic_ipc_led_gpio_table_extra);
}
-static int simatic_ipc_leds_gpio_f7188x_remove(struct platform_device *pdev)
+static void simatic_ipc_leds_gpio_f7188x_remove(struct platform_device *pdev)
{
- return simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table,
- &simatic_ipc_led_gpio_table_extra);
+ simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table,
+ &simatic_ipc_led_gpio_table_extra);
}
static struct platform_driver simatic_ipc_led_gpio_driver = {
.probe = simatic_ipc_leds_gpio_f7188x_probe,
- .remove = simatic_ipc_leds_gpio_f7188x_remove,
+ .remove_new = simatic_ipc_leds_gpio_f7188x_remove,
.driver = {
.name = KBUILD_MODNAME,
},
@@ -15,8 +15,8 @@ int simatic_ipc_leds_gpio_probe(struct platform_device *pdev,
struct gpiod_lookup_table *table,
struct gpiod_lookup_table *table_extra);
-int simatic_ipc_leds_gpio_remove(struct platform_device *pdev,
- struct gpiod_lookup_table *table,
- struct gpiod_lookup_table *table_extra);
+void simatic_ipc_leds_gpio_remove(struct platform_device *pdev,
+ struct gpiod_lookup_table *table,
+ struct gpiod_lookup_table *table_extra);
#endif /* _SIMATIC_IPC_LEDS_GPIO_H */
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Make simatic_ipc_leds_gpio_remove() return void instead of returning zero unconditionally. After that the three remove callbacks that use this function were trivial to convert to return void, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- Hello, compared to (implicit) v1 that can be found at https://lore.kernel.org/linux-leds/20230724054743.310750-1-u.kleine-koenig@pengutronix.de this copes for the addition of another simatic LED driver in commit 7e6d86e99a5d ("leds: simatic-ipc-leds-gpio: Add Elkhart Lake version"). Henning mentioned another patch "platform/x86: add CMOS battery monitoring for simatic IPCs" that would conflict with my v1 patch. I didn't spot a conflict there, though. Best regards Uwe drivers/leds/simple/simatic-ipc-leds-gpio-apollolake.c | 8 ++++---- drivers/leds/simple/simatic-ipc-leds-gpio-core.c | 4 +--- drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c | 7 +++---- drivers/leds/simple/simatic-ipc-leds-gpio-f7188x.c | 8 ++++---- drivers/leds/simple/simatic-ipc-leds-gpio.h | 6 +++--- 5 files changed, 15 insertions(+), 18 deletions(-) base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d