]> git.itanic.dy.fi Git - linux-stable/commitdiff
firmware: arm_scmi: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 27 Dec 2023 16:26:25 +0000 (17:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jan 2024 16:01:14 +0000 (17:01 +0100)
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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/86165c8ccd0bb47000a29e711102795b36c8df41.1703693980.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/arm_scmi/driver.c

index 09371f40d61f48a72abc850c772ac5ec277ec114..5355fe34fff521fd2235717b6acefb955f9634e3 100644 (file)
@@ -2820,7 +2820,7 @@ static int scmi_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int scmi_remove(struct platform_device *pdev)
+static void scmi_remove(struct platform_device *pdev)
 {
        int id;
        struct scmi_info *info = platform_get_drvdata(pdev);
@@ -2854,8 +2854,6 @@ static int scmi_remove(struct platform_device *pdev)
        scmi_cleanup_txrx_channels(info);
 
        ida_free(&scmi_id, info->id);
-
-       return 0;
 }
 
 static ssize_t protocol_version_show(struct device *dev,
@@ -2933,7 +2931,7 @@ static struct platform_driver scmi_driver = {
                   .dev_groups = versions_groups,
                   },
        .probe = scmi_probe,
-       .remove = scmi_remove,
+       .remove_new = scmi_remove,
 };
 
 /**