Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Prasanth R" <ragaprasanth@gmail.com>, linux-rtc@vger.kernel.org
Cc: imx@lists.linux.dev, Frank.Li@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 10/12] rtc: pcf8523: clear the wake IRQ on unbind
Date: Wed, 25 Nov 2026 07:33:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-232810@kernel.org> (raw)
In-Reply-To: <20261125072026.2997493-11-prasanth.r@lineo.co.jp>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] rtc: pcf8523: redundant devm wake cleanup in pcf8523_probe()
  on i2c_bus_type
--

commit 5ba5c98fa87e67c51600bf8ba44e25608c7b2cde
Author: Prasanth R <ragaprasanth@gmail.com>

rtc: pcf8523: clear the wake IRQ on unbind

This commit switches pcf8523_probe() from dev_pm_set_wake_irq() and
device_init_wakeup() to their devm-managed variants so that the wake IRQ
and wakeup source are cleared on driver unbind.

> diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
> index bbd42358a4c24..df70a374ef0ff 100644
> --- a/drivers/rtc/rtc-pcf8523.c
> +++ b/drivers/rtc/rtc-pcf8523.c
> @@ -484,12 +484,12 @@ static int pcf8523_probe(struct i2c_client *client)
>  		if (err)
>  			return err;
>  
> -		dev_pm_set_wake_irq(&client->dev, client->irq);
> +		devm_pm_set_wake_irq(&client->dev, client->irq);
>  	}
>  
>  	wakeup_source = of_property_read_bool(client->dev.of_node, "wakeup-source");
>  	if (client->irq > 0 || wakeup_source)
> -		device_init_wakeup(&client->dev, true);
> +		devm_device_init_wakeup(&client->dev);
>  
>  	return devm_rtc_register_device(rtc);
>  }

[Severity: Medium]
Can an i2c_driver without a .remove callback actually leak its wake IRQ
or wakeup source on unbind?

On unbind, device_remove() invokes i2c_bus_type.remove
(i2c_device_remove()) even when driver->remove is NULL, and
i2c_device_remove() already clears both unconditionally:

drivers/i2c/i2c-core-base.c:i2c_device_remove() {
    ...
	devres_release_group(&client->dev, client->devres_group_id);

	dev_pm_clear_wake_irq(&client->dev);
	device_init_wakeup(&client->dev, false);
    ...
}

i2c_device_probe() performs the same cleanup at err_clear_wakeup_irq when
driver->probe() fails.  Switching to devm_pm_set_wake_irq() and
devm_device_init_wakeup() here only adds redundant devres actions right
before the I2C core repeats the same teardown.  Note also that when
"wakeup-source" is set in DT (setting I2C_CLIENT_WAKE) and
client->irq > 0, i2c_device_probe() already calls dev_pm_set_wake_irq()
before invoking pcf8523_probe(), so the "wake irq already initialized"
warning and -EEXIST happen during the initial probe rather than on
rebind.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125072026.2997493-1-prasanth.r@lineo.co.jp?part=10

  reply	other threads:[~2026-11-25  7:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
2026-11-25  7:20 ` [PATCH 01/12] rtc: snvs: " Prasanth R
2026-11-25  7:20 ` [PATCH 02/12] rtc: mxc: " Prasanth R
2026-11-25  7:20 ` [PATCH 03/12] rtc: mxc_v2: fix unbalanced clock disable on remove Prasanth R
2026-11-25  7:20 ` [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind Prasanth R
2026-11-25  7:25   ` sashiko-bot
2026-11-25  7:20 ` [PATCH 05/12] rtc: imxdi: clear the wake IRQ on removal Prasanth R
2026-11-25  7:20 ` [PATCH 06/12] rtc: da9063: clear the wake IRQ on unbind Prasanth R
2026-11-25  7:20 ` [PATCH 07/12] rtc: fsl-ftm-alarm: " Prasanth R
2026-11-25  7:20 ` [PATCH 08/12] rtc: jz4740: " Prasanth R
2026-11-25  7:20 ` [PATCH 09/12] rtc: atcrtc100: " Prasanth R
2026-11-25  7:20 ` [PATCH 10/12] rtc: pcf8523: " Prasanth R
2026-11-25  7:33   ` sashiko-bot [this message]
2026-11-25  7:20 ` [PATCH 11/12] rtc: pcf85063: " Prasanth R
2026-11-25  7:29   ` sashiko-bot
2026-11-25  7:20 ` [PATCH 12/12] rtc: rv8803: " Prasanth R
2026-11-25  7:32   ` 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=sashiko-outbox-232810@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-rtc@vger.kernel.org \
    --cc=ragaprasanth@gmail.com \
    --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