Devicetree
 help / color / mirror / Atom feed
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 v28 02/10] power: reset: reboot-mode: Add support for predefined reboot modes
Date: Fri, 27 Nov 2026 14:50:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-237611@kernel.org> (raw)
In-Reply-To: <20261127-arm-psci-system_reset2-vendor-reboots-v28-2-da05a33b08d8@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] reboot-mode: duplicate mode entries in
  reboot_mode_add_predefined_modes()
--

commit 92584772bb5470229d1e0aa19cc27e08912a4e4d
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>

power: reset: reboot-mode: Add support for predefined reboot modes

This commit adds support for driver-defined predefined reboot modes and
introduces reboot_mode_driver_init() to initialize reboot-mode driver
state.

> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
> index 328fa37598df3..2345ebd2c1ef7 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);
> +	}
> +
> +	return 0;
> +}

[Severity: Medium]
Should reboot_mode_add_predefined_modes() skip predefined entries whose
name is already present in reboot->head?

When a DT node overrides a predefined mode with the same name,
reboot_mode_register() parses the DT modes first and then appends the
predefined mode onto reboot->head without checking for duplicates.
reboot_mode_create_device() copies every entry from reboot->head into
priv->head, so reading /sys/class/reboot-mode/<driver>/reboot_modes emits
the duplicate mode name twice.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-arm-psci-system_reset2-vendor-reboots-v28-0-da05a33b08d8@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-27 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 14:26 [PATCH v28 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-11-27 14:26 ` [PATCH v28 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
2026-11-27 14:26 ` [PATCH v28 02/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2026-11-27 14:50   ` sashiko-bot [this message]
2026-11-27 14:26 ` [PATCH v28 03/10] firmware: psci: Introduce command-based resets Shivendra Pratap
2026-11-27 14:26 ` [PATCH v28 04/10] firmware: arm: psci: Add support for PSCI auxiliary devices Shivendra Pratap
2026-11-27 14:26 ` [PATCH v28 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2026-11-27 14:26 ` [PATCH v28 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-11-27 14:27 ` [PATCH v28 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
2026-11-27 14:27 ` [PATCH v28 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
2026-11-27 14:27 ` [PATCH v28 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-11-27 14:27 ` [PATCH v28 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=sashiko-outbox-237611@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