aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2023-03-19 11:06:20 +0100
committerRob Herring <robh@kernel.org>2023-03-20 14:59:08 -0500
commitc9c9d764daeeb264c647b0c6a3d2f602a7deb586 (patch)
tree27c9fce386cb2c413998ae1148afa4f9c0635102 /drivers/of
parent13cd9ac670df5e052d3a31ae21bb1787202870dd (diff)
downloadlinux-c9c9d764daeeb264c647b0c6a3d2f602a7deb586.tar.gz
of: unittest: Convert to platform remove callback returning void
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. 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/20230319100620.295849-4-u.kleine-koenig@pengutronix.de Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/unittest.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 0b0b966133b75..ab3e914452562 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1529,13 +1529,12 @@ static int unittest_probe(struct platform_device *pdev)
return 0;
}
-static int unittest_remove(struct platform_device *pdev)
+static void unittest_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
- return 0;
}
static const struct of_device_id unittest_match[] = {
@@ -1545,7 +1544,7 @@ static const struct of_device_id unittest_match[] = {
static struct platform_driver unittest_driver = {
.probe = unittest_probe,
- .remove = unittest_remove,
+ .remove_new = unittest_remove,
.driver = {
.name = "unittest",
.of_match_table = of_match_ptr(unittest_match),
@@ -1626,7 +1625,7 @@ static int unittest_gpio_probe(struct platform_device *pdev)
return ret;
}
-static int unittest_gpio_remove(struct platform_device *pdev)
+static void unittest_gpio_remove(struct platform_device *pdev)
{
struct unittest_gpio_dev *devptr = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
@@ -1637,8 +1636,6 @@ static int unittest_gpio_remove(struct platform_device *pdev)
gpiochip_remove(&devptr->chip);
kfree(devptr);
-
- return 0;
}
static const struct of_device_id unittest_gpio_id[] = {
@@ -1648,7 +1645,7 @@ static const struct of_device_id unittest_gpio_id[] = {
static struct platform_driver unittest_gpio_driver = {
.probe = unittest_gpio_probe,
- .remove = unittest_gpio_remove,
+ .remove_new = unittest_gpio_remove,
.driver = {
.name = "unittest-gpio",
.of_match_table = of_match_ptr(unittest_gpio_id),
@@ -2486,7 +2483,7 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev)
return 0;
}
-static int unittest_i2c_bus_remove(struct platform_device *pdev)
+static void unittest_i2c_bus_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
@@ -2494,8 +2491,6 @@ static int unittest_i2c_bus_remove(struct platform_device *pdev)
dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
i2c_del_adapter(&std->adap);
-
- return 0;
}
static const struct of_device_id unittest_i2c_bus_match[] = {
@@ -2505,7 +2500,7 @@ static const struct of_device_id unittest_i2c_bus_match[] = {
static struct platform_driver unittest_i2c_bus_driver = {
.probe = unittest_i2c_bus_probe,
- .remove = unittest_i2c_bus_remove,
+ .remove_new = unittest_i2c_bus_remove,
.driver = {
.name = "unittest-i2c-bus",
.of_match_table = of_match_ptr(unittest_i2c_bus_match),