Skip to content

Commit

Permalink
clk: x86: Convert to platform remove callback returning void
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Uwe Kleine-König authored and Stephen Boyd committed Mar 29, 2023
1 parent 0d086cc commit 4690d24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions drivers/clk/x86/clk-fch.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,21 @@ 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;

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

pci_dev_put(rdev);
return 0;
}

static struct platform_driver fch_clk_driver = {
Expand All @@ -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);
5 changes: 2 additions & 3 deletions drivers/clk/x86/clk-pmc-atom.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static int plt_clk_probe(struct platform_device *pdev)
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;

Expand All @@ -377,14 +377,13 @@ 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 = {
.driver = {
.name = "clk-pmc-atom",
},
.probe = plt_clk_probe,
.remove = plt_clk_remove,
.remove_new = plt_clk_remove,
};
builtin_platform_driver(plt_clk_driver);

0 comments on commit 4690d24

Please sign in to comment.