From: sashiko-bot@kernel.org
To: "Arash Golgol" <arash.golgol@gmail.com>
Cc: linux-sunxi@lists.linux.dev, media-ci@linuxtv.org
Subject: Re: [PATCH v5 3/3] media: sun6i-csi: bridge: Use V4L2 subdev active state
Date: Tue, 04 Aug 2026 07:45:00 +0000 [thread overview]
Message-ID: <20260804074501.16FA41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804072630.28745-4-arash.golgol@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Incomplete unregistration of the bridge V4L2 subdevice leaves dangling pointers in the global V4L2 async lists when `isp_available` is true.
- [High] The shared IRQ handler accesses hardware registers without checking if the device is active, which can cause bus errors when the device is runtime suspended.
- [High] The runtime suspend callback does not call `synchronize_irq()` before disabling clocks, risking mid-flight IRQ handler execution on powered-down hardware.
--
--- Patch [3]: [PATCH v5 3/3] media: sun6i-csi: bridge: Use V4L2 subdev active state ---
commit 6cd90e8e72a0cec4746b7a5b2e01f5104228f654
Author: Arash Golgol <arash.golgol@gmail.com>
media: sun6i-csi: bridge: Use V4L2 subdev active state
Use the V4L2 subdev active state API to store the active format.
This simplifies the driver not only by dropping the bridge mbus_format
field, but it also allows dropping the bridge lock, replaced with
the state lock.
> diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c
> index d006d9dd01708..43a85bcc2ba28 100644
> --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c
> +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c
[ ... ]
> @@ -868,5 +847,7 @@ void sun6i_csi_bridge_cleanup(struct sun6i_csi_device *csi_dev)
>
> v4l2_device_unregister_subdev(subdev);
>
> + v4l2_subdev_cleanup(subdev);
> +
> media_entity_cleanup(&subdev->entity);
> }
[Severity: High]
This isn't a regression introduced by this patch, but since isp_available
allows the bridge subdevice to be registered asynchronously via
v4l2_async_register_subdev() in sun6i_csi_bridge_setup(), should
sun6i_csi_bridge_cleanup() conditionally call v4l2_async_unregister_subdev()
instead?
Using v4l2_device_unregister_subdev() unconditionally skips removing the
subdevice from the global async list when isp_available is true. Might this
leave a dangling pointer that leads to list corruption upon module unload?
I also noticed a couple of pre-existing regressions in sun6i_csi.c that might
be worth looking into while working in this subsystem.
In sun6i_csi_interrupt():
struct sun6i_csi_device *csi_dev = private;
bool capture_streaming = csi_dev->capture.state.streaming;
struct regmap *regmap = csi_dev->regmap;
u32 status = 0, enable = 0;
regmap_read(regmap, SUN6I_CSI_CH_INT_STA_REG, &status);
[Severity: High]
This is a pre-existing regression, but the shared IRQ handler accesses hardware
registers without checking if the device is active.
If another device sharing this IRQ line fires an interrupt while the sun6i-csi
device is runtime suspended, can this MMIO read cause a bus error?
Should pm_runtime_get_if_active() be used to verify the device is powered
before reading SUN6I_CSI_CH_INT_STA_REG?
In sun6i_csi_suspend():
struct sun6i_csi_device *csi_dev = dev_get_drvdata(dev);
reset_control_assert(csi_dev->reset);
clk_disable_unprepare(csi_dev->clock_ram);
clk_disable_unprepare(csi_dev->clock_mod);
[Severity: High]
This is a pre-existing regression, but since the device uses a shared IRQ, the
suspend routine disables clocks before ensuring no IRQ handler is currently
running.
If the interrupt handler is mid-flight on another CPU when the clocks are
disabled, could it attempt to access MMIO registers on powered-down hardware?
Is it necessary to call synchronize_irq() before turning off the clocks here?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804072630.28745-1-arash.golgol@gmail.com?part=3
next prev parent reply other threads:[~2026-08-04 7:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 7:26 [PATCH v1 0/3] media: sunxi: Resend active-state conversions Arash Golgol
2026-08-04 7:26 ` [PATCH v4 1/3] media: sun6i-mipi-csi2: Use V4L2 subdev active state Arash Golgol
2026-08-04 7:26 ` [PATCH v4 2/3] media: sun8i-a83t-mipi-csi2: " Arash Golgol
2026-08-04 7:26 ` [PATCH v5 3/3] media: sun6i-csi: bridge: " Arash Golgol
2026-08-04 7:45 ` sashiko-bot [this message]
2026-08-12 6:20 ` [PATCH v1 0/3] media: sunxi: Resend active-state conversions arash golgol
2026-09-07 4:45 ` arash golgol
2026-09-17 12:09 ` Laurent Pinchart
2026-09-17 14:29 ` arash golgol
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=20260804074501.16FA41F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arash.golgol@gmail.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=media-ci@linuxtv.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;
as well as URLs for NNTP newsgroup(s).