From: sashiko-bot@kernel.org
To: "Shivendra Pratap" <shivendra.pratap@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v26 02/10] power: reset: reboot-mode: Add support for predefined reboot modes
Date: Mon, 28 Sep 2026 06:26:38 +0000 [thread overview]
Message-ID: <20260928062639.3753D1F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260928-arm-psci-system_reset2-vendor-reboots-v26-2-b24e2348e8e1@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] power: reset: reboot-mode: duplicate sysfs entries for predefined modes
--
commit 613bc6d4edd9d0928986367eb5de6c3fc84d4d4e
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
power: reset: reboot-mode: Add support for predefined reboot modes
reboot-mode based drivers can define a reboot-mode by adding it under
the reboot-mode node in device tree. This limits such drivers, to define
any predefined reboot-modes statically within the driver and creates a
dependency on device-tree.
> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
> index 328fa37598df3..fd61de2263836 100644
> --- a/drivers/power/reset/reboot-mode.c
> +++ b/drivers/power/reset/reboot-mode.c
[ ... ]
> @@ -160,11 +234,38 @@ static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
> return 0;
>
> error:
> - reboot_mode_release_list(priv);
> + reboot_mode_release_list(&priv->head);
> kfree(priv);
> return ret;
> }
>
> +static int reboot_mode_add_predefined_modes(struct reboot_mode_driver *reboot)
> +{
> + const struct reboot_mode_entry *modes = reboot->predefined_modes;
> + struct mode_info *info;
> + size_t i;
> +
> + if (!modes)
> + return 0;
> +
> + for (i = 0; i < reboot->predefined_mode_count; i++) {
> + if (modes[i].name && strpbrk(modes[i].name, "\n ,/"))
> + return -EINVAL;
> +
> + if (!modes[i].count || modes[i].count > ARRAY_SIZE(modes[i].magic))
> + return -EINVAL;
> +
> + info = reboot_mode_create_info(reboot->dev, modes[i].name,
> + modes[i].magic, modes[i].count);
> + if (IS_ERR(info))
> + return PTR_ERR(info);
> +
> + list_add_tail(&info->list, &reboot->head);
[Severity: Medium]
If a predefined mode shares a name with a device tree mode, does this
unconditionally add it to reboot->head, resulting in a duplicate entry?
Since reboot_mode_create_device() directly iterates over reboot->head and
copies these modes into priv->head:
reboot_mode_create_device() {
...
list_for_each_entry(info, &reboot->head, list) {
...
sysfs_info->mode = kstrdup_const(info->mode, GFP_KERNEL);
...
list_add_tail(&sysfs_info->list, &priv->head);
}
}
Will this cause the reboot_modes sysfs attribute to emit duplicate string
values (e.g., 'normal normal') to userspace?
> + }
> +
> + return 0;
> +}
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260928-arm-psci-system_reset2-vendor-reboots-v26-0-b24e2348e8e1@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-09-28 6:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 6:09 [PATCH v26 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 02/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2026-09-28 6:26 ` sashiko-bot [this message]
2026-09-28 17:25 ` Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 03/10] firmware: psci: Introduce command-based resets Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 04/10] firmware: psci: Add support for PSCI auxiliary devices Shivendra Pratap
2026-10-02 13:29 ` Bartosz Golaszewski
2026-09-28 6:09 ` [PATCH v26 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2026-09-28 6:26 ` sashiko-bot
2026-09-28 17:20 ` Shivendra Pratap
2026-10-06 2:53 ` Rob Herring (Arm)
2026-09-28 6:09 ` [PATCH v26 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-10-02 13:30 ` Bartosz Golaszewski
2026-10-04 7:29 ` Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-09-28 6:09 ` [PATCH v26 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
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=20260928062639.3753D1F00899@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shivendra.pratap@oss.qualcomm.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