From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
lee@kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH v1 3/3] mfd: max8907: Convert to use device managed poweroff handler
Date: Sun, 27 Sep 2026 16:07:21 +0000 [thread overview]
Message-ID: <20260927160721.C34521F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260927155745.187758-4-clamor95@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mfd: max8907 sys-off handler returns raw error code halting notifier chain
--
commit 42fddb54f9db77c2dde889b0a3e0f261fd20ec9b
Author: Svyatoslav Ryhel <clamor95@gmail.com>
mfd: max8907: Convert to use device managed poweroff handler
This commit replaces the legacy global pm_power_off function pointer
assignment with the devm_register_sys_off_handler() helper.
> diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
> index 363ac80c0593b..0cecb53b62078 100644
> --- a/drivers/mfd/max8907.c
> +++ b/drivers/mfd/max8907.c
[ ... ]
> @@ -173,19 +174,18 @@ static const struct regmap_irq_chip max8907_rtc_irq_chip = {
> .num_irqs = ARRAY_SIZE(max8907_rtc_irqs),
> };
>
> -static struct max8907 *max8907_pm_off;
> -static void max8907_power_off(void)
> +static int max8907_power_off(struct sys_off_data *data)
> {
> - regmap_update_bits(max8907_pm_off->regmap_gen, MAX8907_REG_RESET_CNFG,
> - MAX8907_MASK_POWER_OFF, MAX8907_MASK_POWER_OFF);
> + struct max8907 *max8907 = data->cb_data;
> +
> + return regmap_update_bits(max8907->regmap_gen, MAX8907_REG_RESET_CNFG,
> + MAX8907_MASK_POWER_OFF, MAX8907_MASK_POWER_OFF);
> }
[Severity: Medium]
Does this inadvertently halt the sys-off notifier chain if the regmap operation
fails?
If regmap_update_bits() in max8907_power_off() encounters an error, such as an
I2C transaction failure, it returns a negative error code like -EIO. Because
notifier chains evaluate return values using the NOTIFY_STOP_MASK (0x8000) bit,
a negative integer will have this bit set. This would immediately abort the
sys-off notifier call chain instead of propagating a proper NOTIFY_* constant.
When this fails, it might prevent lower-priority fallback power-off methods,
like ACPI, PSCI, or EFI shutdown, from being attempted, potentially hanging
the system instead of safely powering off.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927155745.187758-1-clamor95@gmail.com?part=3
prev parent reply other threads:[~2026-09-27 16:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 15:57 [PATCH v1 0/3] mfd: max8907: Schema, pdata and poweroff Svyatoslav Ryhel
2026-09-27 15:57 ` [PATCH v1 1/3] regulator: dt-bindings: maxim,max8907: Convert to DT schema Svyatoslav Ryhel
2026-09-27 16:05 ` sashiko-bot
2026-09-28 12:58 ` Rob Herring (Arm)
2026-09-27 15:57 ` [PATCH v1 2/3] mfd: max8907: Remove platform_data based probing Svyatoslav Ryhel
2026-09-27 16:06 ` sashiko-bot
2026-09-27 15:57 ` [PATCH v1 3/3] mfd: max8907: Convert to use device managed poweroff handler Svyatoslav Ryhel
2026-09-27 16:07 ` 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=20260927160721.C34521F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=clamor95@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lee@kernel.org \
--cc=mfd@lists.linux.dev \
--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