clk: x86: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 12 Mar 2023 16:15:11 +0000 (17:15 +0100)
committerStephen Boyd <sboyd@kernel.org>
Wed, 29 Mar 2023 02:31:45 +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-30-u.kleine-koenig@pengutronix.de
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/x86/clk-fch.c
drivers/clk/x86/clk-pmc-atom.c

index fdc060e..aed7d22 100644 (file)
@@ -92,14 +92,14 @@ static int fch_clk_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int fch_clk_remove(struct platform_device *pdev)
+static void fch_clk_remove(struct platform_device *pdev)
 {
        int i, clks;
        struct pci_dev *rdev;
 
        rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
        if (!rdev)
-               return -ENODEV;
+               return;
 
        clks = pci_match_id(fch_pci_ids, rdev) ? CLK_MAX_FIXED : ST_MAX_CLKS;
 
@@ -107,7 +107,6 @@ static int fch_clk_remove(struct platform_device *pdev)
                clk_hw_unregister(hws[i]);
 
        pci_dev_put(rdev);
-       return 0;
 }
 
 static struct platform_driver fch_clk_driver = {
@@ -116,6 +115,6 @@ static struct platform_driver fch_clk_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = fch_clk_probe,
-       .remove = fch_clk_remove,
+       .remove_new = fch_clk_remove,
 };
 builtin_platform_driver(fch_clk_driver);
index e746e3f..2974dd0 100644 (file)
@@ -367,7 +367,7 @@ err_unreg_clk_plt:
        return err;
 }
 
-static int plt_clk_remove(struct platform_device *pdev)
+static void plt_clk_remove(struct platform_device *pdev)
 {
        struct clk_plt_data *data;
 
@@ -377,7 +377,6 @@ static int plt_clk_remove(struct platform_device *pdev)
        clkdev_drop(data->mclk_lookup);
        plt_clk_unregister_loop(data, PMC_CLK_NUM);
        plt_clk_unregister_parents(data);
-       return 0;
 }
 
 static struct platform_driver plt_clk_driver = {
@@ -385,6 +384,6 @@ static struct platform_driver plt_clk_driver = {
                .name = "clk-pmc-atom",
        },
        .probe = plt_clk_probe,
-       .remove = plt_clk_remove,
+       .remove_new = plt_clk_remove,
 };
 builtin_platform_driver(plt_clk_driver);