All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Salah Triki <salah.triki@gmail.com>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: twl: Check return value of platform_get_irq()
Date: Thu, 24 Jul 2025 09:33:08 +0200	[thread overview]
Message-ID: <20250724073308430368ff@mail.local> (raw)
In-Reply-To: <aIGVJ7UV1wzkQ2Bt@pc>

On 24/07/2025 03:06:31+0100, Salah Triki wrote:
> platform_get_irq() may fail, so check its return value and propagate
> the error in case of failure.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  drivers/rtc/rtc-twl.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index e6106e67e1f4..992b3e1347f2 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -224,8 +224,11 @@ static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
> -	int irq = platform_get_irq(pdev, 0);
> -	int ret;
> +	int irq, ret;
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0)
> +		return irq;

It won't ever fail because we know it already succeeded earlier.

>  
>  	if (enabled) {
>  		ret = set_rtc_irq_bit(twl_rtc,
> -- 
> 2.43.0
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2025-07-24  7:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24  2:06 [PATCH] rtc: twl: Check return value of platform_get_irq() Salah Triki
2025-07-24  7:33 ` Alexandre Belloni [this message]
2025-07-27 16:42   ` Markus Elfring

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=20250724073308430368ff@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=salah.triki@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.