Skip to content

Commit 59bd567

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: hyperbus: hbmc-am654: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Tudor Ambarus <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 326563f commit 59bd567

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mtd/hyperbus/hbmc-am654.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int am654_hbmc_probe(struct platform_device *pdev)
229229
return ret;
230230
}
231231

232-
static int am654_hbmc_remove(struct platform_device *pdev)
232+
static void am654_hbmc_remove(struct platform_device *pdev)
233233
{
234234
struct am654_hbmc_priv *priv = platform_get_drvdata(pdev);
235235
struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv;
@@ -241,8 +241,6 @@ static int am654_hbmc_remove(struct platform_device *pdev)
241241

242242
if (dev_priv->rx_chan)
243243
dma_release_channel(dev_priv->rx_chan);
244-
245-
return 0;
246244
}
247245

248246
static const struct of_device_id am654_hbmc_dt_ids[] = {
@@ -256,7 +254,7 @@ MODULE_DEVICE_TABLE(of, am654_hbmc_dt_ids);
256254

257255
static struct platform_driver am654_hbmc_platform_driver = {
258256
.probe = am654_hbmc_probe,
259-
.remove = am654_hbmc_remove,
257+
.remove_new = am654_hbmc_remove,
260258
.driver = {
261259
.name = "hbmc-am654",
262260
.of_match_table = am654_hbmc_dt_ids,

0 commit comments

Comments
 (0)