Linux-sh Archive mirror
 help / color / mirror / Atom feed
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Rich Felker" <dalias@libc.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Duoming Zhou <duoming@zju.edu.cn>,
	linux-sh@vger.kernel.org, kernel@vpengutronix.de
Subject: Re: [PATCH] sh: push-switch: Convert to platform remove callback returning void
Date: Thu, 02 May 2024 12:27:37 +0200	[thread overview]
Message-ID: <31078e6a359c780316704837ecb96712daf69603.camel@physik.fu-berlin.de> (raw)
In-Reply-To: <20240306211947.97103-2-u.kleine-koenig@pengutronix.de>

On Wed, 2024-03-06 at 22:19 +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@pengutronix.de>
> ---
>  arch/sh/drivers/push-switch.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/sh/drivers/push-switch.c b/arch/sh/drivers/push-switch.c
> index 6ecba5f521eb..362e4860bf52 100644
> --- a/arch/sh/drivers/push-switch.c
> +++ b/arch/sh/drivers/push-switch.c
> @@ -91,7 +91,7 @@ static int switch_drv_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int switch_drv_remove(struct platform_device *pdev)
> +static void switch_drv_remove(struct platform_device *pdev)
>  {
>  	struct push_switch *psw = platform_get_drvdata(pdev);
>  	struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
> @@ -106,13 +106,11 @@ static int switch_drv_remove(struct platform_device *pdev)
>  	free_irq(irq, pdev);
>  
>  	kfree(psw);
> -
> -	return 0;
>  }
>  
>  static struct platform_driver switch_driver = {
>  	.probe		= switch_drv_probe,
> -	.remove		= switch_drv_remove,
> +	.remove_new	= switch_drv_remove,
>  	.driver		= {
>  		.name	= DRV_NAME,
>  	},
> 
> base-commit: 11afac187274a6177a7ac82997f8691c0f469e41

Applied to my sh-linux tree in the for-next branch.

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

      parent reply	other threads:[~2024-05-02 10:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 21:19 [PATCH] sh: push-switch: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-07  8:41 ` Geert Uytterhoeven
2024-04-11  7:18 ` Uwe Kleine-König
2024-04-11  7:47   ` John Paul Adrian Glaubitz
2024-04-11  7:49     ` John Paul Adrian Glaubitz
2024-04-29  7:22       ` Uwe Kleine-König
2024-04-29  7:24         ` John Paul Adrian Glaubitz
2024-04-29  8:30 ` John Paul Adrian Glaubitz
2024-05-02 10:27 ` John Paul Adrian Glaubitz [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=31078e6a359c780316704837ecb96712daf69603.camel@physik.fu-berlin.de \
    --to=glaubitz@physik.fu-berlin.de \
    --cc=dalias@libc.org \
    --cc=duoming@zju.edu.cn \
    --cc=geert+renesas@glider.be \
    --cc=kernel@vpengutronix.de \
    --cc=linux-sh@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=ysato@users.sourceforge.jp \
    /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).