From: sashiko-bot@kernel.org
To: "Zhentao Guo" <zhentao.guo@amlogic.com>
Cc: conor+dt@kernel.org, robh@kernel.org, neil.armstrong@linaro.org,
devicetree@vger.kernel.org, media-ci@linuxtv.org,
linux-amlogic@lists.infradead.org
Subject: Re: [PATCH v8 2/6] firmware: meson: sm: Add video firmware loading SMC call
Date: Mon, 31 Aug 2026 08:45:37 +0000 [thread overview]
Message-ID: <20260831084537.9AF4E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831-b4-s4-vdec-upstream-v8-2-830195b9bd91@amlogic.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] meson_sm_call() unconditionally returns 0 on successful command dispatch, masking SMCCC errors from functions that rely on its return value instead of checking the output parameter.
--
commit 9dde1c44d8065dbf71f452dee2694d932fa3d6ae
Author: Zhentao Guo <zhentao.guo@amlogic.com>
firmware: meson: sm: Add video firmware loading SMC call
This commit adds the SM_LOAD_VIDEO_FW command to the gxbb_chip command
table with SMC ID 0xb200000f for loading video firmware.
> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> index ab9751a59b552..887caa5c625db 100644
> --- a/drivers/firmware/meson/meson_sm.c
> +++ b/drivers/firmware/meson/meson_sm.c
> @@ -48,6 +48,7 @@ static const struct meson_sm_chip gxbb_chip = {
> CMD(SM_THERMAL_CALIB_READ, 0x82000047),
> CMD(SM_A1_PWRC_SET, 0x82000093),
> CMD(SM_A1_PWRC_GET, 0x82000095),
> + CMD(SM_LOAD_VIDEO_FW, 0xb200000f),
[Severity: High]
This is a pre-existing issue, but does meson_sm_call() handle SMCCC
errors correctly?
Looking at meson_sm_call(), it unconditionally returns 0 after dispatching
the command:
drivers/firmware/meson/meson_sm.c:meson_sm_call() {
...
lret = __meson_sm_call(cmd, arg0, arg1, arg2, arg3, arg4);
if (ret)
*ret = lret;
return 0;
}
This masks SMCCC errors from callers that rely on its return value instead
of checking the output parameter. For example, the power domain driver
(drivers/pmdomain/amlogic/meson-secure-pwrc.c) passes a NULL pointer for
the output parameter and relies on the return value of meson_sm_call()
for error checking. This causes it to assume power operations always
succeed, which could lead to a synchronous external abort (kernel panic)
if hardware within a failed power domain is accessed.
Similarly, meson_sm_get_thermal_calib() passes a pointer to receive
calibration data, but if an error occurs, the SMC error code is directly
written into this data, and the function incorrectly returns 0 (success):
drivers/firmware/meson/meson_sm.c:meson_sm_get_thermal_calib() {
...
return meson_sm_call(fw, SM_THERMAL_CALIB_READ, trim_info, tsensor_id,
0, 0, 0, 0);
}
Should meson_sm_call() propagate the error code in lret instead of always
returning 0?
> { /* sentinel */ },
> },
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-b4-s4-vdec-upstream-v8-0-830195b9bd91@amlogic.com?part=2
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Zhentao Guo" <zhentao.guo@amlogic.com>
Cc: conor+dt@kernel.org, robh@kernel.org, neil.armstrong@linaro.org,
devicetree@vger.kernel.org, media-ci@linuxtv.org,
linux-amlogic@lists.infradead.org
Subject: Re: [PATCH v8 2/6] firmware: meson: sm: Add video firmware loading SMC call
Date: Mon, 31 Aug 2026 08:45:37 +0000 [thread overview]
Message-ID: <20260831084537.9AF4E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831-b4-s4-vdec-upstream-v8-2-830195b9bd91@amlogic.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] meson_sm_call() unconditionally returns 0 on successful command dispatch, masking SMCCC errors from functions that rely on its return value instead of checking the output parameter.
--
commit 9dde1c44d8065dbf71f452dee2694d932fa3d6ae
Author: Zhentao Guo <zhentao.guo@amlogic.com>
firmware: meson: sm: Add video firmware loading SMC call
This commit adds the SM_LOAD_VIDEO_FW command to the gxbb_chip command
table with SMC ID 0xb200000f for loading video firmware.
> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> index ab9751a59b552..887caa5c625db 100644
> --- a/drivers/firmware/meson/meson_sm.c
> +++ b/drivers/firmware/meson/meson_sm.c
> @@ -48,6 +48,7 @@ static const struct meson_sm_chip gxbb_chip = {
> CMD(SM_THERMAL_CALIB_READ, 0x82000047),
> CMD(SM_A1_PWRC_SET, 0x82000093),
> CMD(SM_A1_PWRC_GET, 0x82000095),
> + CMD(SM_LOAD_VIDEO_FW, 0xb200000f),
[Severity: High]
This is a pre-existing issue, but does meson_sm_call() handle SMCCC
errors correctly?
Looking at meson_sm_call(), it unconditionally returns 0 after dispatching
the command:
drivers/firmware/meson/meson_sm.c:meson_sm_call() {
...
lret = __meson_sm_call(cmd, arg0, arg1, arg2, arg3, arg4);
if (ret)
*ret = lret;
return 0;
}
This masks SMCCC errors from callers that rely on its return value instead
of checking the output parameter. For example, the power domain driver
(drivers/pmdomain/amlogic/meson-secure-pwrc.c) passes a NULL pointer for
the output parameter and relies on the return value of meson_sm_call()
for error checking. This causes it to assume power operations always
succeed, which could lead to a synchronous external abort (kernel panic)
if hardware within a failed power domain is accessed.
Similarly, meson_sm_get_thermal_calib() passes a pointer to receive
calibration data, but if an error occurs, the SMC error code is directly
written into this data, and the function incorrectly returns 0 (success):
drivers/firmware/meson/meson_sm.c:meson_sm_get_thermal_calib() {
...
return meson_sm_call(fw, SM_THERMAL_CALIB_READ, trim_info, tsensor_id,
0, 0, 0, 0);
}
Should meson_sm_call() propagate the error code in lret instead of always
returning 0?
> { /* sentinel */ },
> },
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-b4-s4-vdec-upstream-v8-0-830195b9bd91@amlogic.com?part=2
next prev parent reply other threads:[~2026-08-31 8:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 8:32 [PATCH v8 0/6] Add Amlogic stateless H.264 video decoder for S4 Zhentao Guo via B4 Relay
2026-08-31 8:32 ` Zhentao Guo
2026-08-31 8:32 ` Zhentao Guo via B4 Relay
2026-08-31 8:32 ` [PATCH v8 1/6] firmware: meson: sm: video firmware loading via secure monitor Zhentao Guo via B4 Relay
2026-08-31 8:32 ` Zhentao Guo
2026-08-31 8:32 ` Zhentao Guo via B4 Relay
2026-08-31 8:43 ` sashiko-bot
2026-08-31 8:43 ` sashiko-bot
2026-08-31 8:32 ` [PATCH v8 2/6] firmware: meson: sm: Add video firmware loading SMC call Zhentao Guo via B4 Relay
2026-08-31 8:32 ` Zhentao Guo
2026-08-31 8:32 ` Zhentao Guo via B4 Relay
2026-08-31 8:45 ` sashiko-bot [this message]
2026-08-31 8:45 ` sashiko-bot
2026-08-31 8:32 ` [PATCH v8 3/6] media: dt-bindings: Add Amlogic V4L2 video decoder Zhentao Guo via B4 Relay
2026-08-31 8:32 ` Zhentao Guo
2026-08-31 8:32 ` Zhentao Guo via B4 Relay
2026-08-31 8:42 ` sashiko-bot
2026-08-31 8:42 ` sashiko-bot
2026-08-31 16:04 ` Conor Dooley
2026-08-31 16:04 ` Conor Dooley
2026-09-01 2:16 ` Zhentao Guo
2026-09-01 2:16 ` Zhentao Guo
2026-08-31 8:32 ` [PATCH v8 4/6] decoder: Add V4L2 stateless H.264 decoder driver Zhentao Guo via B4 Relay
2026-08-31 8:32 ` Zhentao Guo
2026-08-31 8:32 ` Zhentao Guo via B4 Relay
2026-08-31 8:56 ` sashiko-bot
2026-08-31 8:56 ` sashiko-bot
2026-08-31 8:32 ` [PATCH v8 5/6] arm64: dts: amlogic: Add video decoder driver support for S4 SOCs Zhentao Guo via B4 Relay
2026-08-31 8:32 ` Zhentao Guo
2026-08-31 8:32 ` Zhentao Guo via B4 Relay
2026-08-31 8:32 ` [PATCH v8 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC Zhentao Guo via B4 Relay
2026-08-31 8:32 ` Zhentao Guo
2026-08-31 8:32 ` Zhentao Guo via B4 Relay
2026-08-31 8:58 ` sashiko-bot
2026-08-31 8:58 ` sashiko-bot
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=20260831084537.9AF4E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=media-ci@linuxtv.org \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhentao.guo@amlogic.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.