Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-renesas-soc@vger.kernel.org, linux-usb@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH 40/97] usb: gadget/renesas_usbf: Convert to platform remove callback returning void
Date: Sun, 21 May 2023 12:02:56 +0200	[thread overview]
Message-ID: <20230521120256.0eae651f@bootlin.com> (raw)
In-Reply-To: <20230517230239.187727-41-u.kleine-koenig@pengutronix.de>

On Thu, 18 May 2023 01:01:42 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 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() is
> 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>
> ---
>  drivers/usb/gadget/udc/renesas_usbf.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usbf.c b/drivers/usb/gadget/udc/renesas_usbf.c
> index 84ac9fe4ce7f..6cd0af83e91e 100644
> --- a/drivers/usb/gadget/udc/renesas_usbf.c
> +++ b/drivers/usb/gadget/udc/renesas_usbf.c
> @@ -3361,15 +3361,13 @@ static int usbf_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int usbf_remove(struct platform_device *pdev)
> +static void usbf_remove(struct platform_device *pdev)
>  {
>  	struct usbf_udc *udc = platform_get_drvdata(pdev);
>  
>  	usb_del_gadget_udc(&udc->gadget);
>  
>  	pm_runtime_put(&pdev->dev);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id usbf_match[] = {
> @@ -3385,7 +3383,7 @@ static struct platform_driver udc_driver = {
>  		.of_match_table = usbf_match,
>  	},
>  	.probe          = usbf_probe,
> -	.remove         = usbf_remove,
> +	.remove_new     = usbf_remove,
>  };
>  
>  module_platform_driver(udc_driver);

Acked-by: Herve Codina <herve.codina@bootlin.com>

Thanks,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2023-05-21 10:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 23:01 [PATCH 00/97] usb: Convert to platform remove callback returning void Uwe Kleine-König
2023-05-17 23:01 ` [PATCH 40/97] usb: gadget/renesas_usbf: " Uwe Kleine-König
2023-05-19  8:09   ` Geert Uytterhoeven
2023-05-21 10:02   ` Herve Codina [this message]
2023-05-28 11:37 ` [PATCH 00/97] usb: " Greg Kroah-Hartman
2023-05-28 11:39   ` Greg Kroah-Hartman

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=20230521120256.0eae651f@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --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