All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anthony McGivern" <anthony.mcgivern@arm.com>,
	devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH 11/24] media: mali-c720: Add full-resolution output subdevice
Date: Tue, 24 Nov 2026 17:21:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-231696@kernel.org> (raw)
In-Reply-To: <20261124-b4-initial-upstream-candidate-v1-11-0cb9bde1bd30@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] media: mali-c720: premature stream disable in
  mali_c720_fr_pipe_disable_streams()
--

commit e9291c2295f3f6641b25d61f1e2d851fc6eecc95
Author: Anthony McGivern <Anthony.McGivern@arm.com>

media: mali-c720: Add full-resolution output subdevice

This commit adds the full-resolution output 0 (FR0) V4L2 subdevice with RGB
and YUV source pads, including scaler and crop configuration.

> diff --git a/drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c b/drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c
> new file mode 100644
> index 0000000000000..a2f97ebce609b
> --- /dev/null
> +++ b/drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c
> @@ -0,0 +1,1178 @@

[ ... ]

> +static int mali_c720_fr_pipe_enable_streams(struct v4l2_subdev *sd,
> +					    struct v4l2_subdev_state *state, u32 pad,
> +					    u64 streams_mask)
> +{
> +	struct mali_c720_subdev *mdev = v4l2_sd_to_mali_c720_sd(sd);
> +	struct mali_c720 *mali_c720 = mdev->mali_c720;
> +	const struct mali_c720_pipeline_regs *pipeline = mali_c720->registers.top->pipeline;
> +	struct mali_c720_fr_pipe *pipe =
> +		mali_c720_sd_to_sd(mdev, struct mali_c720_fr_pipe);
> +	struct mali_c720_context *ctx = mali_c720_get_active_context(mali_c720);
> +	struct v4l2_subdev *src_sd;
> +	struct media_pad *sink_pad;
> +	int ret;
> +
> +	sink_pad = &pipe->pads[MALI_C720_FR_PIPE_PAD_SINK_VIDEO];
> +	pipe->remote_src = media_pad_remote_pad_unique(sink_pad);
> +	if (IS_ERR(pipe->remote_src)) {
> +		dev_err(mali_c720->dev,
> +			"No remote source for fr 0 pipe\n");
> +		return -EINVAL;
> +	}
> +
> +	src_sd = media_entity_to_v4l2_subdev(pipe->remote_src->entity);
> +	mali_c720_ctx_group_write(ctx, mali_c720->top_base,
> +				  &pipeline->fr0_hv_cv_mux_sel,
> +				  ISP_TOP_FR0_HV_CV_MUX_SEL_HV);
> +
> +	/* Enable the upstream subdevice unless another output already enabled it. */
> +	ret = v4l2_subdev_enable_streams(src_sd, pipe->remote_src->index, BIT(0));
> +	if (ret && ret != -EALREADY)
> +		return ret;
> +
> +	mali_c720_fr_pipe_update_resizer_config(pipe, state);
> +	if (pad == MALI_C720_FR_PIPE_PAD_SOURCE_YUV)
> +		mali_c720_fr_pipe_program_output_formatter(pipe);
> +
> +	guard(spinlock)(&pipe->resizer_lock);
> +	pipe->enabled_crops |= BIT(pad);
> +
> +	return 0;
> +}
> +
> +static int mali_c720_fr_pipe_disable_streams(struct v4l2_subdev *sd,
> +					     struct v4l2_subdev_state *state, u32 pad,
> +					     u64 streams_mask)
> +{
> +	struct mali_c720_subdev *mdev = v4l2_sd_to_mali_c720_sd(sd);
> +	struct mali_c720_fr_pipe *pipe =
> +		mali_c720_sd_to_sd(mdev, struct mali_c720_fr_pipe);
> +	struct v4l2_subdev *src_sd;
> +
> +	if (pipe->remote_src) {
> +		src_sd = media_entity_to_v4l2_subdev(pipe->remote_src->entity);
> +		v4l2_subdev_disable_streams(src_sd, pipe->remote_src->index,
> +					    BIT(0));
> +	}
> +	pipe->remote_src = NULL;
> +
> +	guard(spinlock)(&pipe->resizer_lock);
> +	pipe->enabled_crops &= ~BIT(pad);
> +
> +	return 0;
> +}

[Severity: Medium]
Does mali_c720_fr_pipe_disable_streams() stop the upstream subdevice while
the other source pad is still streaming?

mali_c720_fr_pipe_enable_streams() allows both the RGB and YUV source pads
to share the upstream stream by ignoring -EALREADY, and records each active
pad in pipe->enabled_crops.  However, mali_c720_fr_pipe_disable_streams()
unconditionally disables the upstream stream and clears pipe->remote_src
without checking whether the other pad bit is still set in
pipe->enabled_crops.

Also, if media_pad_remote_pad_unique() fails in
mali_c720_fr_pipe_enable_streams(), pipe->remote_src is left holding an
ERR_PTR, which the truthiness check in mali_c720_fr_pipe_disable_streams()
would treat as a valid pointer.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-initial-upstream-candidate-v1-0-0cb9bde1bd30@arm.com?part=11

  reply	other threads:[~2026-11-24 17:21 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 17:07 [PATCH 00/24] Add Arm Mali-C720 Image Signal Processor Driver Anthony McGivern
2026-11-24 17:07 ` [PATCH 01/24] media: uapi: Add 24-bit Bayer media bus formats Anthony McGivern
2026-11-24 17:07 ` [PATCH 02/24] dt-bindings: media: Add bindings for Arm Mali-C720 Anthony McGivern
2026-11-24 17:18   ` sashiko-bot
2026-11-25  8:51   ` Krzysztof Kozlowski
2026-11-26 14:55     ` Anthony McGivern
2026-11-26 15:12       ` Krzysztof Kozlowski
2026-11-27 12:32         ` Anthony McGivern
2026-11-27 12:49           ` Laurent Pinchart
2026-11-27 14:25             ` Anthony McGivern
2026-11-24 17:07 ` [PATCH 03/24] media: uapi: Add a control ID base for Mali-C720 ISP Anthony McGivern
2026-11-24 17:07 ` [PATCH 04/24] media: mali-c720: Add register access helpers Anthony McGivern
2026-11-24 17:07 ` [PATCH 05/24] media: mali-c720: Add hardware identification Anthony McGivern
2026-11-25  8:52   ` Krzysztof Kozlowski
2026-11-26 15:00     ` Anthony McGivern
2026-11-24 17:07 ` [PATCH 06/24] media: mali-c720: Add format handling Anthony McGivern
2026-11-24 17:07 ` [PATCH 07/24] media: mali-c720: Add hardware discovery support Anthony McGivern
2026-11-24 17:07 ` [PATCH 08/24] media: mali-c720: Add context manager and interrupt handling Anthony McGivern
2026-11-24 17:07 ` [PATCH 09/24] media: mali-c720: Add input frontend subdevice Anthony McGivern
2026-11-24 17:07 ` [PATCH 10/24] media: mali-c720: Add ISP and human vision subdevices Anthony McGivern
2026-11-24 17:07 ` [PATCH 11/24] media: mali-c720: Add full-resolution output subdevice Anthony McGivern
2026-11-24 17:21   ` sashiko-bot [this message]
2026-11-24 17:07 ` [PATCH 12/24] media: mali-c720: Add video capture nodes Anthony McGivern
2026-11-24 17:35   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 13/24] media: mali-c720: Add Mali-C720 ISP driver Anthony McGivern
2026-11-25  8:55   ` Krzysztof Kozlowski
2026-11-26 15:53     ` Anthony McGivern
2026-12-01 18:40       ` Linus Walleij
2026-12-01 22:10         ` Laurent Pinchart
2026-12-01 22:20           ` Linus Walleij
2026-11-24 17:07 ` [PATCH 14/24] media: mali-c720: Add test pattern generator subdevices Anthony McGivern
2026-11-24 17:07 ` [PATCH 15/24] media: Documentation: Add Mali-C720 ISP documentation Anthony McGivern
2026-11-24 17:20   ` sashiko-bot
2026-11-28  0:43   ` kernel test robot
2026-11-24 17:07 ` [PATCH 16/24] media: uapi: Add Mali-C720 statistics meta format Anthony McGivern
2026-11-24 17:07 ` [PATCH 17/24] media: uapi: Add statistics structs to mali-c720-config.h Anthony McGivern
2026-11-24 17:26   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 18/24] media: mali-c720: Add 3A statistics video node Anthony McGivern
2026-11-24 17:31   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 19/24] media: Documentation: Document Mali-C720 statistics capture Anthony McGivern
2026-11-24 17:25   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 20/24] media: uapi: Add Mali-C720 parameters meta format Anthony McGivern
2026-11-24 17:07 ` [PATCH 21/24] media: uapi: Add parameter structs to mali-c720-config.h Anthony McGivern
2026-11-24 17:33   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 22/24] media: mali-c720: Add parameters video node Anthony McGivern
2026-11-24 17:45   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 23/24] media: Documentation: Document Mali-C720 parameter settings Anthony McGivern
2026-11-24 17:07 ` [PATCH 24/24] MAINTAINERS: Add entry for mali-c720 driver Anthony McGivern

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-231696@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anthony.mcgivern@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.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 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.