From: sashiko-bot@kernel.org
To: "Balakrishnan Sambath" <balakrishnan.s@microchip.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v6 09/12] media: microchip-isc: add SAMA7G5 hue and saturation controls
Date: Wed, 03 Jun 2026 07:21:42 +0000 [thread overview]
Message-ID: <20260603072143.0A0A01F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603-microchip-isc-fixes-v6-9-8c3d7474a768@microchip.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] V4L2 controls are improperly gated due to deferred pipeline configuration, causing incorrect active states and state desynchronization when inactive controls are modified.
Pre-existing issues:
- [High] `mutex_destroy(&isc->awb_mutex)` is called on an uninitialized or already destroyed mutex during async error and unbind paths.
--
commit a918c53cb3531019eb23300da7b6bcbdebef4df4
Author: Balakrishnan Sambath <balakrishnan.s@microchip.com>
media: microchip-isc: add SAMA7G5 hue and saturation controls
This commit exposes hue and saturation as V4L2 controls for the SAMA7G5
CBHS block. The controls are gated based on the has_cbhs flag and are
initialized to neutral values at probe.
> diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
> --- a/drivers/media/platform/microchip/microchip-isc-base.c
> +++ b/drivers/media/platform/microchip/microchip-isc-base.c
> @@ -859,6 +859,46 @@ static int isc_try_configure_pipeline(struct isc_device *isc)
[ ... ]
> +static void isc_update_cbhs_ctrls(struct isc_device *isc)
> +{
> + bool cbhs_active = isc->config.bits_pipeline & CBHS_ENABLE;
> + bool chroma_active = cbhs_active && isc_format_is_yuv(isc->config.fourcc);
> +
> + if (isc->brightness_ctrl)
> + v4l2_ctrl_activate(isc->brightness_ctrl, cbhs_active);
> + if (isc->contrast_ctrl)
> + v4l2_ctrl_activate(isc->contrast_ctrl, cbhs_active);
> + if (isc->hue_ctrl)
> + v4l2_ctrl_activate(isc->hue_ctrl, chroma_active);
> + if (isc->saturation_ctrl)
> + v4l2_ctrl_activate(isc->saturation_ctrl, chroma_active);
> +}
[ ... ]
> @@ -902,6 +942,7 @@ static int isc_set_fmt(struct isc_device *isc, struct v4l2_format *f)
> /* make the try configuration active */
> isc->config = isc->try_config;
> isc->fmt = isc->try_fmt;
> + isc_update_cbhs_ctrls(isc);
[Severity: Medium]
Does this leave the CBHS controls incorrectly deactivated before streaming
starts?
Because isc->config.bits_pipeline is only updated during link validation
(VIDIOC_STREAMON), it appears bits_pipeline will be zero or stale here
in isc_set_fmt().
If the controls remain incorrectly inactive, and userspace tries to set
them, isc_s_ctrl() might quietly reject the change:
drivers/media/platform/microchip/microchip-isc-base.c:isc_s_ctrl() {
...
if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE)
return 0;
...
}
Will this silently ignore the update while the V4L2 core caches the new
value, causing the driver's internal hardware state to permanently diverge
from the V4L2 framework's cached state?
[Severity: High]
This is a pre-existing issue, but can the async error handling path cause
a double-destroy or uninitialized-destroy panic?
If an early operation such as v4l2_device_register_subdev_nodes() fails
in isc_async_complete(), it returns an error before initializing
isc->awb_mutex. The V4L2 async core handles this failure by unbinding the
subdevices, which triggers isc_async_unbind().
isc_async_unbind() unconditionally calls:
drivers/media/platform/microchip/microchip-isc-base.c:isc_async_unbind() {
...
mutex_destroy(&isc->awb_mutex);
...
}
Could this lead to a kernel oops on an uninitialized mutex if
CONFIG_DEBUG_MUTEXES is enabled? Additionally, if isc_async_complete()
fails after initialization, it explicitly destroys the mutex in its error
block, causing isc_async_unbind() to destroy it a second time.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-microchip-isc-fixes-v6-0-8c3d7474a768@microchip.com?part=9
next prev parent reply other threads:[~2026-06-03 7:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 6:58 [PATCH v6 00/12] media: microchip-isc: fixes and enhancements Balakrishnan Sambath
2026-06-03 6:58 ` [PATCH v6 01/12] media: microchip-isc: fix SBGGR10 Bayer pattern Balakrishnan Sambath
2026-06-03 6:58 ` [PATCH v6 02/12] media: microchip-isc: fix WB offset and gain register field masking Balakrishnan Sambath
2026-06-03 7:14 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 03/12] media: microchip-isc: fix race condition on stream stop Balakrishnan Sambath
2026-06-03 7:22 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 04/12] media: microchip-isc: fix PM runtime leak in AWB work handler Balakrishnan Sambath
2026-06-03 7:17 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 05/12] media: microchip-isc: add driver documentation Balakrishnan Sambath
2026-06-03 7:09 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 06/12] media: microchip-isc: set SAM9X7 maximum resolution to 2560x1920 Balakrishnan Sambath
2026-06-03 7:11 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 07/12] media: microchip-isc: configure DPC and pipeline for SAMA7G5 Balakrishnan Sambath
2026-06-03 7:11 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 08/12] media: microchip-isc: add gamma 1.8 and 2.4 correction curves Balakrishnan Sambath
2026-06-03 6:58 ` [PATCH v6 09/12] media: microchip-isc: add SAMA7G5 hue and saturation controls Balakrishnan Sambath
2026-06-03 7:21 ` sashiko-bot [this message]
2026-06-03 6:58 ` [PATCH v6 10/12] media: microchip-isc: use weighted averages for Grey World AWB Balakrishnan Sambath
2026-06-03 7:14 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 11/12] media: microchip-isc: smooth AWB gains with EMA filter Balakrishnan Sambath
2026-06-03 7:18 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 12/12] media: microchip-isc: scale DPC black level to sensor bit depth Balakrishnan Sambath
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=20260603072143.0A0A01F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=balakrishnan.s@microchip.com \
--cc=linux-media@vger.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.