Skip to content

Commit 4690d24

Browse files
Uwe Kleine-Königbebarino
authored andcommitted
clk: x86: 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/20230312161512.2715500-30-u.kleine-koenig@pengutronix.de Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 0d086cc commit 4690d24

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

drivers/clk/x86/clk-fch.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,21 @@ static int fch_clk_probe(struct platform_device *pdev)
9292
return 0;
9393
}
9494

95-
static int fch_clk_remove(struct platform_device *pdev)
95+
static void fch_clk_remove(struct platform_device *pdev)
9696
{
9797
int i, clks;
9898
struct pci_dev *rdev;
9999

100100
rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
101101
if (!rdev)
102-
return -ENODEV;
102+
return;
103103

104104
clks = pci_match_id(fch_pci_ids, rdev) ? CLK_MAX_FIXED : ST_MAX_CLKS;
105105

106106
for (i = 0; i < clks; i++)
107107
clk_hw_unregister(hws[i]);
108108

109109
pci_dev_put(rdev);
110-
return 0;
111110
}
112111

113112
static struct platform_driver fch_clk_driver = {
@@ -116,6 +115,6 @@ static struct platform_driver fch_clk_driver = {
116115
.suppress_bind_attrs = true,
117116
},
118117
.probe = fch_clk_probe,
119-
.remove = fch_clk_remove,
118+
.remove_new = fch_clk_remove,
120119
};
121120
builtin_platform_driver(fch_clk_driver);

drivers/clk/x86/clk-pmc-atom.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static int plt_clk_probe(struct platform_device *pdev)
367367
return err;
368368
}
369369

370-
static int plt_clk_remove(struct platform_device *pdev)
370+
static void plt_clk_remove(struct platform_device *pdev)
371371
{
372372
struct clk_plt_data *data;
373373

@@ -377,14 +377,13 @@ static int plt_clk_remove(struct platform_device *pdev)
377377
clkdev_drop(data->mclk_lookup);
378378
plt_clk_unregister_loop(data, PMC_CLK_NUM);
379379
plt_clk_unregister_parents(data);
380-
return 0;
381380
}
382381

383382
static struct platform_driver plt_clk_driver = {
384383
.driver = {
385384
.name = "clk-pmc-atom",
386385
},
387386
.probe = plt_clk_probe,
388-
.remove = plt_clk_remove,
387+
.remove_new = plt_clk_remove,
389388
};
390389
builtin_platform_driver(plt_clk_driver);

0 commit comments

Comments
 (0)