Skip to content

Commit b83b736

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
staging: fbtft: 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. The function fbtft_driver_remove_pdev() (that exists several times as it's part of a macro expansion) returns zero unconditionally, so it can be trivially converted to return void without semantic changes. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20231026214407.2508590-2-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0210a68 commit b83b736

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/staging/fbtft/fbtft.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,11 @@ static int fbtft_driver_probe_pdev(struct platform_device *pdev) \
310310
return fbtft_probe_common(_display, NULL, pdev); \
311311
} \
312312
\
313-
static int fbtft_driver_remove_pdev(struct platform_device *pdev) \
313+
static void fbtft_driver_remove_pdev(struct platform_device *pdev) \
314314
{ \
315315
struct fb_info *info = platform_get_drvdata(pdev); \
316316
\
317317
fbtft_remove_common(&pdev->dev, info); \
318-
return 0; \
319318
} \
320319
\
321320
FBTFT_DT_TABLE(_compatible) \
@@ -329,7 +328,7 @@ static struct platform_driver fbtft_driver_platform_driver = { \
329328
.of_match_table = dt_ids, \
330329
}, \
331330
.probe = fbtft_driver_probe_pdev, \
332-
.remove = fbtft_driver_remove_pdev, \
331+
.remove_new = fbtft_driver_remove_pdev, \
333332
}; \
334333
\
335334
static int __init fbtft_driver_module_init(void) \

0 commit comments

Comments
 (0)