From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Tang Bin <tangbin@cmss.chinamobile.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: cpcap-pwrbutton: Add an error handling
Date: Sun, 5 Sep 2021 19:07:02 -0700 [thread overview]
Message-ID: <YTV3xny2etxZ/TNG@google.com> (raw)
In-Reply-To: <20210802121740.8700-1-tangbin@cmss.chinamobile.com>
Hi,
On Mon, Aug 02, 2021 at 08:17:40PM +0800, Tang Bin wrote:
> The function cpcap_power_button_probe() does not perform
> sufficient error checking after executing platform_get_irq(),
> thus fix it.
Yes, indeed. request_irq will fail regardless, but it is nice to return
proper error code.
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
> drivers/input/misc/cpcap-pwrbutton.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/misc/cpcap-pwrbutton.c b/drivers/input/misc/cpcap-pwrbutton.c
> index 0abef6321..0a1f2e8b4 100644
> --- a/drivers/input/misc/cpcap-pwrbutton.c
> +++ b/drivers/input/misc/cpcap-pwrbutton.c
> @@ -57,6 +57,9 @@ static int cpcap_power_button_probe(struct platform_device *pdev)
> int irq = platform_get_irq(pdev, 0);
> int err;
>
> + if (irq < 0)
> + return irq;
I moved the platform_get_irq() here and applied, thank you.
--
Dmitry
prev parent reply other threads:[~2021-09-06 2:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 12:17 [PATCH] input: cpcap-pwrbutton: Add an error handling Tang Bin
2021-09-06 2:07 ` Dmitry Torokhov [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=YTV3xny2etxZ/TNG@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tangbin@cmss.chinamobile.com \
/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