Linux RTC
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antoni Pokusinski" <apokusinski01@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org
Subject: Re: [PATCH v5 5/9] rtc: abx80x: add irq to struct abx80x_priv
Date: Tue, 11 Aug 2026 19:51:28 +0000	[thread overview]
Message-ID: <20260811195130.013C31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260811194034.28937-6-apokusinski01@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Failure to clear client->irq on IRQ request error leaves a dangling positive IRQ value that is erroneously disabled during system shutdown.
--

--- Patch [5]: [PATCH v5 5/9] rtc: abx80x: add irq to struct abx80x_priv ---
commit e5e02251b0d732530fe4bd8df1edc078a44d0fe3
Author: Antoni Pokusinski <apokusinski01@gmail.com>

rtc: abx80x: add irq to struct abx80x_priv
    
This commit adds the irq number to struct abx80x_priv so it is not tied
to the i2c_client. This allows the irq to be easily accessed in the case
of ABX81X SPI clocks.

> diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> index 485d1ea08030d..12a4dbfec6396 100644
> --- a/drivers/rtc/rtc-abx80x.c
> +++ b/drivers/rtc/rtc-abx80x.c

[ ... ]

> @@ -994,19 +997,19 @@ static int abx80x_probe(struct i2c_client *client)
>  		return -EIO;
>  	}
>  
> -	if (client->irq > 0) {
> -		dev_info(&client->dev, "IRQ %d supplied\n", client->irq);
> -		err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> +	if (priv->irq > 0) {
> +		dev_info(&client->dev, "IRQ %d supplied\n", priv->irq);
> +		err = devm_request_threaded_irq(&client->dev, priv->irq, NULL,
>  						abx80x_handle_irq,
>  						IRQF_SHARED | IRQF_ONESHOT,
>  						"abx8xx",
>  						client);
>  		if (err) {
>  			dev_err(&client->dev, "unable to request IRQ, alarms disabled\n");
> -			client->irq = 0;
> +			priv->irq = 0;
[Severity: Medium]
By removing the client->irq = 0 assignment here, doesn't this leave a
dangling positive IRQ value in the I2C client if the request fails?

If devm_request_threaded_irq() fails, the driver gracefully falls back to
running with alarms disabled. However, during system shutdown, the I2C core
in i2c_device_shutdown() relies on client->irq to disable interrupts:

drivers/i2c/i2c-core-base.c:i2c_device_shutdown() {
    ...
    if (client->irq > 0)
        disable_irq(client->irq);
    ...
}

Since this driver uses IRQF_SHARED and has no .shutdown callback to
override the default behavior, leaving client->irq > 0 means the I2C core
will unconditionally call disable_irq() on an IRQ line the driver failed
to acquire.

Could this erroneously mask the shared IRQ line for other active devices
during system shutdown?

>  		}
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260811194034.28937-1-apokusinski01@gmail.com?part=5

  reply	other threads:[~2026-08-11 19:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 19:40 [PATCH v5 0/9] rtc: abx80x: add support for abx81x Antoni Pokusinski
2026-08-11 19:40 ` [PATCH v5 1/9] dt-bindings: rtc: abx80x: document ABX81X RTCs Antoni Pokusinski
2026-08-11 19:48   ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 2/9] rtc: abx80x: fix error check after i2c_smbus_read in read_alarm() Antoni Pokusinski
2026-08-11 19:55   ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 3/9] rtc: abx80x: add mutex protection for register writes Antoni Pokusinski
2026-08-11 19:56   ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 4/9] rtc: abx80x: properly handle shared IRQs Antoni Pokusinski
2026-08-11 19:53   ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 5/9] rtc: abx80x: add irq to struct abx80x_priv Antoni Pokusinski
2026-08-11 19:51   ` sashiko-bot [this message]
2026-08-11 19:40 ` [PATCH v5 6/9] rtc: abx80x: use regmap instead of I2C specific API Antoni Pokusinski
2026-08-11 19:55   ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 7/9] rtc: abx80x: replace read-modify-write pattern with regmap helpers Antoni Pokusinski
2026-08-11 19:56   ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 8/9] rtc: abx80x: create abx80x_i2c_probe() Antoni Pokusinski
2026-08-11 19:54   ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 9/9] rtc: abx80x: add support for ABX81X Antoni Pokusinski
2026-08-11 20:03   ` sashiko-bot

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=20260811195130.013C31F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=apokusinski01@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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