All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Donggeun Yoo" <donggeunyoo.kernel@gmail.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH] regulator: pf1550: fix which regulator is notified
Date: Fri, 04 Sep 2026 11:10:38 +0000	[thread overview]
Message-ID: <20260904111039.705FA1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904105624.48577-1-donggeunyoo.kernel@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The interrupt handler unconditionally returns IRQ_HANDLED even when it completely fails to recognize the interrupt, defeating spurious interrupt detection.
--

commit 756013e824bd37aa338c50b32f4e6024e5f64dfc
Author: Donggeun Yoo <donggeunyoo.kernel@gmail.com>

    regulator: pf1550: fix which regulator is notified

This commit fixes the regulator notification logic in the pf1550 driver.
It replaces string-based matching of regulator names with ID-based lookups
to reliably notify the correct consumer when a fault occurs.

> diff --git a/drivers/regulator/pf1550-regulator.c b/drivers/regulator/pf1550-regulator.c
> index 610eac9bb9cb2..ceee553a84b23 100644
> --- a/drivers/regulator/pf1550-regulator.c
> +++ b/drivers/regulator/pf1550-regulator.c
[ ... ]
> @@ -283,63 +283,61 @@ static struct pf1550_desc pf1550_regulators[] = {
[ ... ]
>  static irqreturn_t pf1550_regulator_irq_handler(int irq, void *data)
>  {
> +	const struct pf1550_regulator_irq *map;
>  	struct pf1550_regulator_info *info = data;
>  	struct device *dev = info->dev;
>  	struct platform_device *pdev = to_platform_device(dev);
>  	int i, irq_type = -1;
> -	unsigned int event;
>  
>  	for (i = 0; i < PF1550_REGULATOR_IRQ_NR; i++)
>  		if (irq == platform_get_irq(pdev, i))
>  			irq_type = i;
>  
[ ... ]
> +	if (irq_type < 0 || irq_type >= (int)ARRAY_SIZE(pf1550_regulator_irqs)) {
> +		dev_err(dev, "regulator interrupt: irq %d occurred\n", irq_type);
> +		return IRQ_HANDLED;
                ^^^^^^^^^^^^^^^^^^^
[Severity: High]
This is a pre-existing issue, but returning IRQ_HANDLED when the driver
completely fails to recognize the interrupt defeats the kernel's spurious
interrupt detection.

If pf1550_regulator_irq_handler() is invoked with an IRQ that does not match
any index in the loop, irq_type remains -1 and this branch is taken. Since
IRQ_HANDLED is returned, the spurious interrupt detection is falsely told
the interrupt was handled successfully and will not mask the virtual IRQ line.

If the PMIC continuously asserts an unhandled fault, could the parent
regmap-irq thread loop endlessly resulting in an interrupt storm and CPU
lockup? Should this return IRQ_NONE instead?

>  	}
>  
> +	map = &pf1550_regulator_irqs[irq_type];
> +
> +	for (i = 0; i < PF1550_MAX_REGULATOR; i++)
> +		if (rdev_get_id(info->rdevs[i]) == map->id)
> +			regulator_notifier_call_chain(info->rdevs[i],
> +						      map->event, NULL);
> +
>  	return IRQ_HANDLED;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260904105624.48577-1-donggeunyoo.kernel@gmail.com?part=1

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 10:56 [PATCH] regulator: pf1550: fix which regulator is notified Donggeun Yoo
2026-09-04 11:10 ` sashiko-bot [this message]
2026-09-05  5:42   ` Donggeun Yoo
2026-09-07 17:09 ` Mark Brown

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=20260904111039.705FA1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=donggeunyoo.kernel@gmail.com \
    --cc=imx@lists.linux.dev \
    --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 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.