Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Ricardo Ribalda <ribalda@chromium.org>,
	Naushir Patuck <naush@raspberrypi.com>,
	Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,
	linux-media@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] media: bcm2835-unicam: Convert to platform remove callback returning void
Date: Mon, 6 May 2024 14:15:30 +0300	[thread overview]
Message-ID: <20240506111530.GB21429@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240506100917.1544174-2-u.kleine-koenig@pengutronix.de>

Hi Uwe,

Thank you for the patch.

On Mon, May 06, 2024 at 12:09:16PM +0200, 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@pengutronix.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> Hello,
> 
> this driver appeared in next-20240506. Given that I want to change struct
> platform_driver::remove after the merge-window for v6.10 closes, it would be
> great if this patch went in together with commit creating the drivers.

Hans, could you pick this up ?

>  drivers/media/platform/broadcom/bcm2835-unicam.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
> index 3c7878d8d79b..b11bcec5b225 100644
> --- a/drivers/media/platform/broadcom/bcm2835-unicam.c
> +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
> @@ -2704,7 +2704,7 @@ static int unicam_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int unicam_remove(struct platform_device *pdev)
> +static void unicam_remove(struct platform_device *pdev)
>  {
>  	struct unicam_device *unicam = platform_get_drvdata(pdev);
>  
> @@ -2718,8 +2718,6 @@ static int unicam_remove(struct platform_device *pdev)
>  	unicam_put(unicam);
>  
>  	pm_runtime_disable(&pdev->dev);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id unicam_of_match[] = {
> @@ -2730,7 +2728,7 @@ MODULE_DEVICE_TABLE(of, unicam_of_match);
>  
>  static struct platform_driver unicam_driver = {
>  	.probe		= unicam_probe,
> -	.remove		= unicam_remove,
> +	.remove_new	= unicam_remove,
>  	.driver = {
>  		.name	= UNICAM_MODULE_NAME,
>  		.pm	= pm_ptr(&unicam_pm_ops),

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2024-05-06 11:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 10:09 [PATCH] media: bcm2835-unicam: Convert to platform remove callback returning void Uwe Kleine-König
2024-05-06 11:15 ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240506111530.GB21429@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jeanmichel.hautbois@ideasonboard.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=naush@raspberrypi.com \
    --cc=ribalda@chromium.org \
    --cc=rjui@broadcom.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sbranden@broadcom.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).