Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Uwe Kleine-König and committed by
Stephen Boyd
4690d246 0d086cc5

+5 -7
+3 -4
drivers/clk/x86/clk-fch.c
··· 92 92 return 0; 93 93 } 94 94 95 - static int fch_clk_remove(struct platform_device *pdev) 95 + static void fch_clk_remove(struct platform_device *pdev) 96 96 { 97 97 int i, clks; 98 98 struct pci_dev *rdev; 99 99 100 100 rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0)); 101 101 if (!rdev) 102 - return -ENODEV; 102 + return; 103 103 104 104 clks = pci_match_id(fch_pci_ids, rdev) ? CLK_MAX_FIXED : ST_MAX_CLKS; 105 105 ··· 107 107 clk_hw_unregister(hws[i]); 108 108 109 109 pci_dev_put(rdev); 110 - return 0; 111 110 } 112 111 113 112 static struct platform_driver fch_clk_driver = { ··· 115 116 .suppress_bind_attrs = true, 116 117 }, 117 118 .probe = fch_clk_probe, 118 - .remove = fch_clk_remove, 119 + .remove_new = fch_clk_remove, 119 120 }; 120 121 builtin_platform_driver(fch_clk_driver);
+2 -3
drivers/clk/x86/clk-pmc-atom.c
··· 367 367 return err; 368 368 } 369 369 370 - static int plt_clk_remove(struct platform_device *pdev) 370 + static void plt_clk_remove(struct platform_device *pdev) 371 371 { 372 372 struct clk_plt_data *data; 373 373 ··· 377 377 clkdev_drop(data->mclk_lookup); 378 378 plt_clk_unregister_loop(data, PMC_CLK_NUM); 379 379 plt_clk_unregister_parents(data); 380 - return 0; 381 380 } 382 381 383 382 static struct platform_driver plt_clk_driver = { ··· 384 385 .name = "clk-pmc-atom", 385 386 }, 386 387 .probe = plt_clk_probe, 387 - .remove = plt_clk_remove, 388 + .remove_new = plt_clk_remove, 388 389 }; 389 390 builtin_platform_driver(plt_clk_driver);