[PATCH 3/5] media: nxp: imx8-isi: Convert to platform remove callback returning void
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Feb 23 05:14:12 PST 2024
Hi Uwe,
Thank you for the patch.
On Fri, Feb 23, 2024 at 01:59:06PM +0100, 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 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 <u.kleine-koenig at pengutronix.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> index f73facb97dc5..c2013995049c 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> @@ -506,7 +506,7 @@ static int mxc_isi_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int mxc_isi_remove(struct platform_device *pdev)
> +static void mxc_isi_remove(struct platform_device *pdev)
> {
> struct mxc_isi_dev *isi = platform_get_drvdata(pdev);
> unsigned int i;
> @@ -523,8 +523,6 @@ static int mxc_isi_remove(struct platform_device *pdev)
> mxc_isi_v4l2_cleanup(isi);
>
> pm_runtime_disable(isi->dev);
> -
> - return 0;
> }
>
> static const struct of_device_id mxc_isi_of_match[] = {
> @@ -537,7 +535,7 @@ MODULE_DEVICE_TABLE(of, mxc_isi_of_match);
>
> static struct platform_driver mxc_isi_driver = {
> .probe = mxc_isi_probe,
> - .remove = mxc_isi_remove,
> + .remove_new = mxc_isi_remove,
> .driver = {
> .of_match_table = mxc_isi_of_match,
> .name = MXC_ISI_DRIVER_NAME,
--
Regards,
Laurent Pinchart
More information about the linux-arm-kernel
mailing list