From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>
Cc: "Christophe Leroy" <christophe.leroy@csgroup.eu>,
<linuxppc-dev@lists.ozlabs.org>, <kernel@pengutronix.de>,
<linux-serial@vger.kernel.org>
Subject: Re: [PATCH 2/2] tty: hvc: hvc_opal: Convert to platform remove callback returning void
Date: Mon, 13 Nov 2023 19:45:34 +1000 [thread overview]
Message-ID: <CWXL6C3YNTI6.2OBLBYUWUQG3W@wheely> (raw)
In-Reply-To: <20231105214406.3765906-6-u.kleine-koenig@pengutronix.de>
On Mon Nov 6, 2023 at 7:44 AM AEST, 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.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/tty/hvc/hvc_opal.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
> index 8995b253cf90..2cdf66e395cc 100644
> --- a/drivers/tty/hvc/hvc_opal.c
> +++ b/drivers/tty/hvc/hvc_opal.c
> @@ -232,7 +232,7 @@ static int hvc_opal_probe(struct platform_device *dev)
> return 0;
> }
>
> -static int hvc_opal_remove(struct platform_device *dev)
> +static void hvc_opal_remove(struct platform_device *dev)
> {
> struct hvc_struct *hp = dev_get_drvdata(&dev->dev);
> int termno;
> @@ -242,13 +242,11 @@ static int hvc_opal_remove(struct platform_device *dev)
> if (hvc_opal_privs[termno] != &hvc_opal_boot_priv)
> kfree(hvc_opal_privs[termno]);
> hvc_opal_privs[termno] = NULL;
> -
> - return 0;
> }
>
> static struct platform_driver hvc_opal_driver = {
> .probe = hvc_opal_probe,
> - .remove = hvc_opal_remove,
> + .remove_new = hvc_opal_remove,
> .driver = {
> .name = hvc_opal_name,
> .of_match_table = hvc_opal_match,
prev parent reply other threads:[~2023-11-13 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 21:44 [PATCH 0/2] tty: hvc: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-05 21:44 ` [PATCH 1/2] tty: hvc: Make hvc_remove() return no value Uwe Kleine-König
2023-11-13 9:45 ` Nicholas Piggin
2023-11-13 9:57 ` Uwe Kleine-König
2023-11-13 10:24 ` Nicholas Piggin
2023-11-05 21:44 ` [PATCH 2/2] tty: hvc: hvc_opal: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-13 9:45 ` Nicholas Piggin [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=CWXL6C3YNTI6.2OBLBYUWUQG3W@wheely \
--to=npiggin@gmail.com \
--cc=christophe.leroy@csgroup.eu \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-serial@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--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