Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2 5/7] hwmon: (pwm-fan) Remove redundant dev_err()
Date: Mon, 20 Jul 2026 06:45:59 +0000	[thread overview]
Message-ID: <20260720064559.88ACD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720063745.309331-6-panchuang@vivo.com>

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

Pre-existing issues:
- [High] Unbalanced regulator enable count during devres cleanup if fan-shutdown-percent is set.
--

--- Patch [5]: [PATCH v2 5/7] hwmon: (pwm-fan) Remove redundant dev_err() ---
commit 1f579d7c79ca89d1d4a39ad9aa36221339e0a01b
Author: Pan Chuang <panchuang@vivo.com>

hwmon: (pwm-fan) Remove redundant dev_err()

Since devm_request_irq() automatically logs error messages on failure,
this commit removes the redundant driver-specific dev_err() call in the
probe function.

> diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
> index 37f37813ea511..3b87f65bae058 100644
> --- a/drivers/hwmon/pwm-fan.c
> +++ b/drivers/hwmon/pwm-fan.c
> @@ -628,12 +628,8 @@ static int pwm_fan_probe(struct platform_device *pdev)
>  		if (tach->irq > 0) {
>  			ret = devm_request_irq(dev, tach->irq, pulse_handler,
>  					       IRQF_NO_THREAD, pdev->name, tach);
> -			if (ret) {
> -				dev_err(dev,
> -					"Failed to request interrupt: %d\n",
> -					ret);
> +			if (ret)
>  				return ret;

[Severity: High]
This isn't a bug introduced by this patch, but does this error path trigger
an unbalanced regulator enable count if fan-shutdown-percent is set?

If devm_request_irq() fails here, devres teardown executes in reverse order.
First, pwm_fan_cleanup() runs and explicitly enables the regulator to shut
down the fan:

drivers/hwmon/pwm-fan.c:pwm_fan_cleanup() {
    ...
    if (ctx->pwm_shutdown) {
        ctx->enable_mode = pwm_enable_reg_enable;
        __set_pwm(ctx, ctx->pwm_shutdown);
    } else {
    ...
}

Later in the devres unwind, devm_regulator_release() calls regulator_put().
Because pwm_fan_cleanup() left the regulator enabled, does regulator_put()
detect a non-zero enable count and trigger a kernel warning stack trace while
leaking the reference?

>  		}
>  
>  		if (!ctx->pulses_per_revolution[i]) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720063745.309331-1-panchuang@vivo.com?part=5

  reply	other threads:[~2026-07-20  6:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  6:37 [PATCH v2 0/7] hwmon: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-20  6:37 ` [PATCH v2 1/7] hwmon: (axi-fan-control) Remove redundant dev_err_probe() Pan Chuang
2026-07-20  6:47   ` sashiko-bot
2026-07-20 14:32   ` Guenter Roeck
2026-07-20  6:37 ` [PATCH v2 2/7] hwmon: (da9055) Remove redundant dev_err() Pan Chuang
2026-07-20  6:40   ` sashiko-bot
2026-07-20 14:33   ` Guenter Roeck
2026-07-20  6:37 ` [PATCH v2 3/7] hwmon: (lm90) " Pan Chuang
2026-07-20  6:42   ` sashiko-bot
2026-07-20 14:33   ` Guenter Roeck
2026-07-20  6:37 ` [PATCH v2 4/7] hwmon: (npcm750-pwm-fan) " Pan Chuang
2026-07-20  6:52   ` sashiko-bot
2026-07-20 14:34   ` Guenter Roeck
2026-07-20  6:37 ` [PATCH v2 5/7] hwmon: (pwm-fan) " Pan Chuang
2026-07-20  6:45   ` sashiko-bot [this message]
2026-07-20 14:35   ` Guenter Roeck
2026-07-20  6:37 ` [PATCH v2 6/7] hwmon: (sht15) " Pan Chuang
2026-07-20  6:47   ` sashiko-bot
2026-07-20 14:35   ` Guenter Roeck
2026-07-20  6:37 ` [PATCH v2 7/7] hwmon: (pmbus) " Pan Chuang
2026-07-20  6:43   ` sashiko-bot
2026-07-20 14:36   ` Guenter Roeck

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=20260720064559.88ACD1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=panchuang@vivo.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