Linux RTC
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Myeonghun Pak" <mhun512@gmail.com>
Cc: wsa+renesas@sang-engineering.com, linux-rtc@vger.kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 2/2] rtc: renesas-rtca3: Join interrupt handlers before unregistering the RTC
Date: Sun, 11 Oct 2026 23:04:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-167505@kernel.org> (raw)
In-Reply-To: <20261011225657.rtca3-irq-ordering.2@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rtc: renesas-rtca3: mixing goto and scoped_guard in rtca3_set_alarm()
--

commit 847b7d6e6378d6cee33935541f2c60ff982bf01d
Author: Myeonghun Pak <mhun512@gmail.com>

rtc: renesas-rtca3: Join interrupt handlers before unregistering the RTC

This commit addresses an issue where interrupt handlers might still run
after the RTC operations have been cleared. It tracks a stopping state
to reject setup requests and disables IRQs synchronously during removal.

> diff --git a/drivers/rtc/rtc-renesas-rtca3.c b/drivers/rtc/rtc-renesas-rtca3.c
> index c304ed60edc6c..9b177a131c272 100644
> --- a/drivers/rtc/rtc-renesas-rtca3.c
> +++ b/drivers/rtc/rtc-renesas-rtca3.c
[ ... ]
> @@ -392,6 +399,9 @@ static int rtca3_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
>  	int ret;
>  
>  	scoped_guard(spinlock_irqsave, &priv->lock) {
> +		if (priv->stopping)
> +			return -ENODEV;
> +

[Severity: Low]
Does this mix goto-based error handling and scope-based cleanup helpers in
the same function?

According to include/linux/cleanup.h and subsystem guidelines, usage of
"goto" and cleanup helpers should never be mixed in the same function. All
resources that need a "goto" cleanup should either be converted to
scope-based cleanup or remain manually managed.

In this case, rtca3_set_alarm() uses
scoped_guard(spinlock_irqsave, &priv->lock) here, but later relies on:

    if (ret)
        goto setup_failed;

which violates the cleanup helper guidelines and creates confusing ownership
and control flow semantics during alarm setup failures.

>  		tmp = readb(priv->base + RTCA3_RCR2);
>  		if (!(tmp & RTCA3_RCR2_START))
>  			return -EPERM;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011225657.rtca3-irq-ordering.0@gmail.com?part=2

      reply	other threads:[~2026-10-11 23:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 22:57 [PATCH 0/2] rtc: renesas-rtca3: Fix IRQ initialization and teardown ordering Myeonghun Pak
2026-10-11 22:57 ` [PATCH 1/2] rtc: renesas-rtca3: Initialize the RTC before requesting interrupts Myeonghun Pak
2026-10-11 23:08   ` sashiko-bot
2026-10-11 22:57 ` [PATCH 2/2] rtc: renesas-rtca3: Join interrupt handlers before unregistering the RTC Myeonghun Pak
2026-10-11 23:04   ` sashiko-bot [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=sashiko-outbox-167505@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mhun512@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.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