From: Jeff LaBundy <jeff@labundy.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
linux-input@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] Input: iqs62x-keys - Suppress duplicated error message in .remove()
Date: Mon, 27 Mar 2023 18:27:24 -0500 [thread overview]
Message-ID: <ZCImXFuXgh+rsRl5@nixie71> (raw)
In-Reply-To: <20230318225110.261439-1-u.kleine-koenig@pengutronix.de>
Hi Uwe,
On Sat, Mar 18, 2023 at 11:51:10PM +0100, Uwe Kleine-König wrote:
> If a platform driver's remove callback returns non-zero the driver core
> emits an error message. In such a case however iqs62x_keys_remove()
> already issued a (better) message. So return zero to suppress the
> generic message.
>
> This patch has no other side effects as platform_remove() ignores the
> return value of .remove() after the warning.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
I was traveling all last week, and therefore unable to voice my opposition
in time. However, I figured I would still provide my feedback in case this
change may be proposed for other cases.
> ---
> drivers/input/keyboard/iqs62x-keys.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/iqs62x-keys.c b/drivers/input/keyboard/iqs62x-keys.c
> index db793a550c25..02ceebad7bda 100644
> --- a/drivers/input/keyboard/iqs62x-keys.c
> +++ b/drivers/input/keyboard/iqs62x-keys.c
> @@ -320,7 +320,7 @@ static int iqs62x_keys_remove(struct platform_device *pdev)
> if (ret)
> dev_err(&pdev->dev, "Failed to unregister notifier: %d\n", ret);
>
> - return ret;
> + return 0;
In my opinion, we should never silence a function's return value, especially
in service of what is ultimately innocuous and cosmetic in nature. While this
specific example is harmless today, the caller can change and hence should be
the only instance who decides whether the return value is important.
If having both fine and subsequently coarse print statements is unacceptable,
I would have preferred to drop this driver's print statement and continue to
return ret. Or at the very least, include a comment as to why we deliberately
ignore the return value.
However, it's quite common for drivers to print a detailed message from probe
followed by the core printing "failed to probe," so I don't see why the remove
case cannot be the same. At any rate, this is just my $.02.
> }
>
> static struct platform_driver iqs62x_keys_platform_driver = {
>
> base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
> --
> 2.39.2
>
Kind regards,
Jeff LaBundy
next prev parent reply other threads:[~2023-03-27 23:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-18 22:51 [PATCH] Input: iqs62x-keys - Suppress duplicated error message in .remove() Uwe Kleine-König
2023-03-20 4:28 ` Dmitry Torokhov
2023-03-27 23:27 ` Jeff LaBundy [this message]
2023-03-28 6:08 ` Uwe Kleine-König
2023-03-29 2:00 ` Jeff LaBundy
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=ZCImXFuXgh+rsRl5@nixie71 \
--to=jeff@labundy.com \
--cc=dmitry.torokhov@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-input@vger.kernel.org \
--cc=mkorpershoek@baylibre.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 NNTP newsgroup(s).