Skip to content

Commit e0748d6

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: maps: sun_uflash: 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 553cc00 commit e0748d6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mtd/maps/sun_uflash.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static int uflash_probe(struct platform_device *op)
118118
return uflash_devinit(op, dp);
119119
}
120120

121-
static int uflash_remove(struct platform_device *op)
121+
static void uflash_remove(struct platform_device *op)
122122
{
123123
struct uflash_dev *up = dev_get_drvdata(&op->dev);
124124

@@ -132,8 +132,6 @@ static int uflash_remove(struct platform_device *op)
132132
}
133133

134134
kfree(up);
135-
136-
return 0;
137135
}
138136

139137
static const struct of_device_id uflash_match[] = {
@@ -151,7 +149,7 @@ static struct platform_driver uflash_driver = {
151149
.of_match_table = uflash_match,
152150
},
153151
.probe = uflash_probe,
154-
.remove = uflash_remove,
152+
.remove_new = uflash_remove,
155153
};
156154

157155
module_platform_driver(uflash_driver);

0 commit comments

Comments
 (0)