Skip to content

Commit 87b1e9a

Browse files
Uwe Kleine-Könighdeller
authored andcommitted
fbdev: via: 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> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 4a5ef62 commit 87b1e9a

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/video/fbdev/via/via-gpio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int viafb_gpio_probe(struct platform_device *platdev)
262262
}
263263

264264

265-
static int viafb_gpio_remove(struct platform_device *platdev)
265+
static void viafb_gpio_remove(struct platform_device *platdev)
266266
{
267267
unsigned long flags;
268268
int i;
@@ -285,15 +285,14 @@ static int viafb_gpio_remove(struct platform_device *platdev)
285285
viafb_gpio_disable(viafb_gpio_config.active_gpios[i]);
286286
viafb_gpio_config.gpio_chip.ngpio = 0;
287287
spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags);
288-
return 0;
289288
}
290289

291290
static struct platform_driver via_gpio_driver = {
292291
.driver = {
293292
.name = "viafb-gpio",
294293
},
295294
.probe = viafb_gpio_probe,
296-
.remove = viafb_gpio_remove,
295+
.remove_new = viafb_gpio_remove,
297296
};
298297

299298
int viafb_gpio_init(void)

drivers/video/fbdev/via/via_i2c.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int viafb_i2c_probe(struct platform_device *platdev)
246246
return 0;
247247
}
248248

249-
static int viafb_i2c_remove(struct platform_device *platdev)
249+
static void viafb_i2c_remove(struct platform_device *platdev)
250250
{
251251
int i;
252252

@@ -259,15 +259,14 @@ static int viafb_i2c_remove(struct platform_device *platdev)
259259
if (i2c_stuff->is_active)
260260
i2c_del_adapter(&i2c_stuff->adapter);
261261
}
262-
return 0;
263262
}
264263

265264
static struct platform_driver via_i2c_driver = {
266265
.driver = {
267266
.name = "viafb-i2c",
268267
},
269268
.probe = viafb_i2c_probe,
270-
.remove = viafb_i2c_remove,
269+
.remove_new = viafb_i2c_remove,
271270
};
272271

273272
int viafb_i2c_init(void)

0 commit comments

Comments
 (0)