From: sashiko-bot@kernel.org
To: "Shivendra Pratap" <shivendra.pratap@oss.qualcomm.com>
Cc: krzk+dt@kernel.org, conor+dt@kernel.org, robh@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v22 07/13] power: reset: Add psci-reboot-mode driver
Date: Thu, 14 May 2026 22:49:27 +0000 [thread overview]
Message-ID: <20260514224928.58AD2C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260514-arm-psci-system_reset2-vendor-reboots-v22-7-28a5bde07483@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Leaked predefined reboot modes if devm_reboot_mode_register() fails.
- [Low] Missing explicit header inclusions for macros.
- [Low] Missing MODULE_DESCRIPTION macro.
--
commit 4f9479b4f7059dfd06d1f3ce3dd92984cbf01921
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
power: reset: Add psci-reboot-mode driver
This commit adds a psci-reboot-mode driver to handle predefined and
vendor-specific PSCI resets via the reboot-mode framework. It allows
userspace to trigger supported PSCI resets using standard reboot system
calls.
[ ... ]
> diff --git a/drivers/power/reset/psci-reboot-mode.c b/drivers/power/reset/psci-reboot-mode.c
> new file mode 100644
> index 0000000000000..845b2a1816ce5
> --- /dev/null
> +++ b/drivers/power/reset/psci-reboot-mode.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + */
> +
> +#include <linux/device.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/psci.h>
> +#include <linux/reboot-mode.h>
> +#include <linux/types.h>
This isn't a bug, but does this file need to explicitly include linux/bits.h
for the BIT_ULL macro, and linux/array_size.h for ARRAY_SIZE? Relying on
indirect inclusion can sometimes lead to sudden build failures if upstream
headers change.
[ ... ]
> +static int psci_reboot_mode_probe(struct platform_device *pdev)
> +{
> + struct reboot_mode_driver *reboot;
> + size_t count;
> + int ret;
> +
> + reboot = devm_kzalloc(&pdev->dev, sizeof(*reboot), GFP_KERNEL);
> + if (!reboot)
> + return -ENOMEM;
> +
> + reboot_mode_driver_init(reboot, &pdev->dev, psci_reboot_mode_write);
> +
> + /* Skip PSCI SYSTEM_RESET2 modes if unsupported */
> + count = psci_has_system_reset2_support() ? ARRAY_SIZE(psci_resets) : 1;
> + ret = reboot_mode_add_predefined_modes(reboot, psci_resets, count);
> + if (ret)
> + return ret;
> +
> + return devm_reboot_mode_register(&pdev->dev, reboot);
Does this leak the dynamically allocated predefined modes if
devm_reboot_mode_register() fails?
Looking at reboot_mode_add_predefined_modes(), it allocates mode_info structs
and adds them to reboot->predefined_modes. If devm_reboot_mode_register()
fails (for example, if its internal devres_alloc() returns -ENOMEM), it simply
returns the error without calling reboot_mode_register().
While devres will clean up the reboot object itself, is there any mechanism
that frees the mode_info items added to the predefined_modes list on this
error path?
> +}
[ ... ]
> +module_platform_driver(psci_reboot_mode_driver);
> +
> +MODULE_LICENSE("GPL");
This isn't a bug, but should there be a MODULE_DESCRIPTION macro here to avoid
warnings or build failures with recent compiler checks?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260514-arm-psci-system_reset2-vendor-reboots-v22-0-28a5bde07483@oss.qualcomm.com?part=7
next prev parent reply other threads:[~2026-05-14 22:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 14:25 [PATCH v22 00/13] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 01/13] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 02/13] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
2026-05-14 20:15 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 03/13] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2026-05-14 21:09 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 04/13] firmware: psci: Introduce command-based resets Shivendra Pratap
2026-05-14 21:23 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 05/13] mfd: psci-mfd: Add PSCI MFD driver for cpuidle-psci-domain cell Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 06/13] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 07/13] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-05-14 22:49 ` sashiko-bot [this message]
2026-05-14 14:25 ` [PATCH v22 08/13] mfd: core: Add firmware-node support to MFD cells Shivendra Pratap
2026-05-14 23:19 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 09/13] mfd: psci-mfd: Add psci-reboot-mode child cell Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 10/13] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 11/13] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 12/13] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-05-15 0:24 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 13/13] 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=20260514224928.58AD2C2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@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 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.