[PATCH 28/53] drm/mediatek: Convert to platform remove callback returning void
Matthias Brugger
matthias.bgg at gmail.com
Mon May 8 01:25:46 PDT 2023
On 07/05/2023 18:25, Uwe Kleine-König wrote:
> 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 at pengutronix.de>
Reviewed-by: Matthias Brugger <matthias.bgg at gmail.com>
> ---
> drivers/gpu/drm/mediatek/mtk_cec.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_cec.c b/drivers/gpu/drm/mediatek/mtk_cec.c
> index b640bc0559e7..f47f417d8ba6 100644
> --- a/drivers/gpu/drm/mediatek/mtk_cec.c
> +++ b/drivers/gpu/drm/mediatek/mtk_cec.c
> @@ -235,13 +235,12 @@ static int mtk_cec_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int mtk_cec_remove(struct platform_device *pdev)
> +static void mtk_cec_remove(struct platform_device *pdev)
> {
> struct mtk_cec *cec = platform_get_drvdata(pdev);
>
> mtk_cec_htplg_irq_disable(cec);
> clk_disable_unprepare(cec->clk);
> - return 0;
> }
>
> static const struct of_device_id mtk_cec_of_ids[] = {
> @@ -252,7 +251,7 @@ MODULE_DEVICE_TABLE(of, mtk_cec_of_ids);
>
> struct platform_driver mtk_cec_driver = {
> .probe = mtk_cec_probe,
> - .remove = mtk_cec_remove,
> + .remove_new = mtk_cec_remove,
> .driver = {
> .name = "mediatek-cec",
> .of_match_table = mtk_cec_of_ids,
More information about the linux-arm-kernel
mailing list