Skip to content

Commit 48d85ac

Browse files
Uwe Kleine-Königandreas-gaisler
authored andcommitted
sparc: chmc: 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]> Reviewed-by: Andreas Larsson <[email protected]> Link: https://lore.kernel.org/r/9fbd788bbca4efd2f596e3c56d045db450756c80.1712755381.git.u.kleine-koenig@pengutronix.de Signed-off-by: Andreas Larsson <[email protected]>
1 parent 9f2072c commit 48d85ac

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/sparc/kernel/chmc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ static void jbusmc_destroy(struct platform_device *op, struct jbusmc *p)
788788
kfree(p);
789789
}
790790

791-
static int us3mc_remove(struct platform_device *op)
791+
static void us3mc_remove(struct platform_device *op)
792792
{
793793
void *p = dev_get_drvdata(&op->dev);
794794

@@ -798,7 +798,6 @@ static int us3mc_remove(struct platform_device *op)
798798
else if (mc_type == MC_TYPE_JBUS)
799799
jbusmc_destroy(op, p);
800800
}
801-
return 0;
802801
}
803802

804803
static const struct of_device_id us3mc_match[] = {
@@ -815,7 +814,7 @@ static struct platform_driver us3mc_driver = {
815814
.of_match_table = us3mc_match,
816815
},
817816
.probe = us3mc_probe,
818-
.remove = us3mc_remove,
817+
.remove_new = us3mc_remove,
819818
};
820819

821820
static inline bool us3mc_platform(void)

0 commit comments

Comments
 (0)