Skip to content

Commit 5882bf9

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: maps: lantiq-flash: 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 54600e4 commit 5882bf9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mtd/maps/lantiq-flash.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,14 @@ ltq_mtd_probe(struct platform_device *pdev)
166166
return err;
167167
}
168168

169-
static int
170-
ltq_mtd_remove(struct platform_device *pdev)
169+
static void ltq_mtd_remove(struct platform_device *pdev)
171170
{
172171
struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev);
173172

174173
if (ltq_mtd && ltq_mtd->mtd) {
175174
mtd_device_unregister(ltq_mtd->mtd);
176175
map_destroy(ltq_mtd->mtd);
177176
}
178-
return 0;
179177
}
180178

181179
static const struct of_device_id ltq_mtd_match[] = {
@@ -186,7 +184,7 @@ MODULE_DEVICE_TABLE(of, ltq_mtd_match);
186184

187185
static struct platform_driver ltq_mtd_driver = {
188186
.probe = ltq_mtd_probe,
189-
.remove = ltq_mtd_remove,
187+
.remove_new = ltq_mtd_remove,
190188
.driver = {
191189
.name = "ltq-nor",
192190
.of_match_table = ltq_mtd_match,

0 commit comments

Comments
 (0)