[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YTV3xny2etxZ/TNG@google.com>
Date: Sun, 5 Sep 2021 19:07:02 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Tang Bin <tangbin@...s.chinamobile.com>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] input: cpcap-pwrbutton: Add an error handling
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@...s.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
Powered by blists - more mailing lists