clk: mvebu: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 12 Mar 2023 16:15:03 +0000 (17:15 +0100)
committerStephen Boyd <sboyd@kernel.org>
Wed, 29 Mar 2023 02:31:44 +0000 (19:31 -0700)
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/20230312161512.2715500-22-u.kleine-koenig@pengutronix.de
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mvebu/armada-37xx-periph.c
drivers/clk/mvebu/armada-37xx-tbg.c
drivers/clk/mvebu/armada-37xx-xtal.c

index e3777ca..3ae6078 100644 (file)
@@ -781,7 +781,7 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int armada_3700_periph_clock_remove(struct platform_device *pdev)
+static void armada_3700_periph_clock_remove(struct platform_device *pdev)
 {
        struct clk_periph_driver_data *data = platform_get_drvdata(pdev);
        struct clk_hw_onecell_data *hw_data = data->hw_data;
@@ -791,13 +791,11 @@ static int armada_3700_periph_clock_remove(struct platform_device *pdev)
 
        for (i = 0; i < hw_data->num; i++)
                clk_hw_unregister(hw_data->hws[i]);
-
-       return 0;
 }
 
 static struct platform_driver armada_3700_periph_clock_driver = {
        .probe = armada_3700_periph_clock_probe,
-       .remove = armada_3700_periph_clock_remove,
+       .remove_new = armada_3700_periph_clock_remove,
        .driver         = {
                .name   = "marvell-armada-3700-periph-clock",
                .of_match_table = armada_3700_periph_clock_of_match,
index fc403ad..eccc1ae 100644 (file)
@@ -126,7 +126,7 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
        return of_clk_add_hw_provider(np, of_clk_hw_onecell_get, hw_tbg_data);
 }
 
-static int armada_3700_tbg_clock_remove(struct platform_device *pdev)
+static void armada_3700_tbg_clock_remove(struct platform_device *pdev)
 {
        int i;
        struct clk_hw_onecell_data *hw_tbg_data = platform_get_drvdata(pdev);
@@ -134,8 +134,6 @@ static int armada_3700_tbg_clock_remove(struct platform_device *pdev)
        of_clk_del_provider(pdev->dev.of_node);
        for (i = 0; i < hw_tbg_data->num; i++)
                clk_hw_unregister_fixed_factor(hw_tbg_data->hws[i]);
-
-       return 0;
 }
 
 static const struct of_device_id armada_3700_tbg_clock_of_match[] = {
@@ -145,7 +143,7 @@ static const struct of_device_id armada_3700_tbg_clock_of_match[] = {
 
 static struct platform_driver armada_3700_tbg_clock_driver = {
        .probe = armada_3700_tbg_clock_probe,
-       .remove = armada_3700_tbg_clock_remove,
+       .remove_new = armada_3700_tbg_clock_remove,
        .driver         = {
                .name   = "marvell-armada-3700-tbg-clock",
                .of_match_table = armada_3700_tbg_clock_of_match,
index 4127135..0e2e7d0 100644 (file)
@@ -65,11 +65,9 @@ static int armada_3700_xtal_clock_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int armada_3700_xtal_clock_remove(struct platform_device *pdev)
+static void armada_3700_xtal_clock_remove(struct platform_device *pdev)
 {
        of_clk_del_provider(pdev->dev.of_node);
-
-       return 0;
 }
 
 static const struct of_device_id armada_3700_xtal_clock_of_match[] = {
@@ -79,7 +77,7 @@ static const struct of_device_id armada_3700_xtal_clock_of_match[] = {
 
 static struct platform_driver armada_3700_xtal_clock_driver = {
        .probe = armada_3700_xtal_clock_probe,
-       .remove = armada_3700_xtal_clock_remove,
+       .remove_new = armada_3700_xtal_clock_remove,
        .driver         = {
                .name   = "marvell-armada-3700-xtal-clock",
                .of_match_table = armada_3700_xtal_clock_of_match,