From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Michael Chang <zhang971090220@gmail.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
Sasha Levin <sashal@kernel.org>,
kwliu@nuvoton.com, kflin@nuvoton.com, mchehab@kernel.org,
linux-media@vger.kernel.org, openbmc@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.15 022/110] media: nuvoton: npcm-video: Fix stuck due to no video signal error
Date: Sun, 1 Jun 2025 19:23:04 -0400 [thread overview]
Message-ID: <20250601232435.3507697-22-sashal@kernel.org> (raw)
In-Reply-To: <20250601232435.3507697-1-sashal@kernel.org>
From: Michael Chang <zhang971090220@gmail.com>
[ Upstream commit 497f1fb94759fa0c638f15c12b1ab3e586bccfcb ]
Fix the issue when start_frame and detect_resolution
functions are executed at the same time, which may cause driver
stops capturing due to status of no video signal error.
Signed-off-by: Michael Chang <zhang971090220@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Now let me analyze this commit based on the provided information:
**YES** This commit should be backported to stable kernel trees based on
the following analysis: 1. **Bug Fix Nature**: The commit specifically
addresses a driver stuck issue caused by a race condition between the
`start_frame` and `detect_resolution` functions. This is a clear bugfix
that affects the operational functionality of the driver. 2. **User
Impact**: When this race condition occurs, the driver stops capturing
completely due to a "no video signal error" - this directly impacts
users who rely on the video capture functionality. 3. **Minimal and
Contained Changes**: The fix makes only a small, targeted change to the
`npcm_video_detect_resolution()` function in
`drivers/media/platform/nuvoton/npcm-video.c`. Specifically: - Removes
the premature setting of `video->v4l2_input_status =
V4L2_IN_ST_NO_SIGNAL` at the beginning - Only sets this status flag when
the resolution is actually invalid (width/height are 0) - Adds proper
debugging messages for both valid and invalid resolution cases 4. **Low
Risk**: The change is logical and safe - instead of immediately assuming
"no signal" and then potentially overriding it later, the code now only
sets the "no signal" status when there's actually an invalid resolution
detected. This eliminates the race condition without introducing new
complexity. 5. **Similar Pattern to Backported Commits**: Looking at the
reference commits, this follows the same pattern as "Similar Commit #1"
(marked YES) which also fixed reference handling issues in the same
driver. Both commits: - Fix driver-specific bugs - Make small, contained
changes - Address operational issues that affect users - Don't introduce
new features or architectural changes 6. **Race Condition Fix**: Race
condition fixes are typically good candidates for stable backporting as
they address timing-dependent bugs that can be difficult to diagnose and
significantly impact system reliability. The fix addresses a specific
functional bug where the driver could get stuck due to improper status
flag handling during concurrent operations, making it an appropriate
candidate for stable tree inclusion.
drivers/media/platform/nuvoton/npcm-video.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c
index 7a9d8928ae401..3022fdcf66ec7 100644
--- a/drivers/media/platform/nuvoton/npcm-video.c
+++ b/drivers/media/platform/nuvoton/npcm-video.c
@@ -863,7 +863,6 @@ static void npcm_video_detect_resolution(struct npcm_video *video)
struct regmap *gfxi = video->gfx_regmap;
unsigned int dispst;
- video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL;
det->width = npcm_video_hres(video);
det->height = npcm_video_vres(video);
@@ -892,12 +891,16 @@ static void npcm_video_detect_resolution(struct npcm_video *video)
clear_bit(VIDEO_RES_CHANGING, &video->flags);
}
- if (det->width && det->height)
+ if (det->width && det->height) {
video->v4l2_input_status = 0;
-
- dev_dbg(video->dev, "Got resolution[%dx%d] -> [%dx%d], status %d\n",
- act->width, act->height, det->width, det->height,
- video->v4l2_input_status);
+ dev_dbg(video->dev, "Got resolution[%dx%d] -> [%dx%d], status %d\n",
+ act->width, act->height, det->width, det->height,
+ video->v4l2_input_status);
+ } else {
+ video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL;
+ dev_err(video->dev, "Got invalid resolution[%dx%d]\n", det->width,
+ det->height);
+ }
}
static int npcm_video_set_resolution(struct npcm_video *video,
--
2.39.5
next prev parent reply other threads:[~2025-06-01 23:25 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-01 23:22 [PATCH AUTOSEL 6.15 001/110] drm/amd/display: disable DPP RCG before DPP CLK enable Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 002/110] drm/bridge: select DRM_KMS_HELPER for AUX_BRIDGE Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 003/110] drm/amdgpu/gfx6: fix CSIB handling Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 004/110] media: imx-jpeg: Check decoding is ongoing for motion-jpeg Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 005/110] drm/rockchip: inno-hdmi: Fix video timing HSYNC/VSYNC polarity setting for rk3036 Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 006/110] drm/dp: add option to disable zero sized address only transactions Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 007/110] sunrpc: update nextcheck time when adding new cache entries Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 008/110] drm/amdgpu: Fix API status offset for MES queue reset Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 009/110] drm/amd/display: DCN32 null data check Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 010/110] drm/xe: Fix CFI violation when accessing sysfs files Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 011/110] drm/bridge: analogix_dp: Add irq flag IRQF_NO_AUTOEN instead of calling disable_irq() Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 012/110] workqueue: Fix race condition in wq->stats incrementation Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 013/110] drm/panel/sharp-ls043t1le01: Use _multi variants Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 014/110] exfat: fix double free in delayed_free Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 015/110] drm/bridge: anx7625: enable HPD interrupts Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 016/110] arm64/cpuinfo: only show one cpu's info in c_show() Sasha Levin
2025-06-01 23:22 ` [PATCH AUTOSEL 6.15 017/110] drm/panthor: Don't update MMU_INT_MASK in panthor_mmu_irq_handler() Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 018/110] drm/bridge: anx7625: change the gpiod_set_value API Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 019/110] exfat: do not clear volume dirty flag during sync Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 020/110] drm/amdkfd: Drop workaround for GC v9.4.3 revID 0 Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 021/110] drm/amdgpu/gfx11: fix CSIB handling Sasha Levin
2025-06-01 23:23 ` Sasha Levin [this message]
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 023/110] drm/nouveau: fix hibernate on disabled GPU Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 024/110] media: i2c: imx334: Enable runtime PM before sub-device registration Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 025/110] drm/amd/display: Avoid divide by zero by initializing dummy pitch to 1 Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 026/110] drm/nouveau/gsp: fix rm shutdown wait condition Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 027/110] drm/msm/hdmi: add runtime PM calls to DDC transfer function Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 028/110] media: uapi: v4l: Fix V4L2_TYPE_IS_OUTPUT condition Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 029/110] drm/amd/display: Add NULL pointer checks in dm_force_atomic_commit() Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 030/110] media: verisilicon: Enable wide 4K in AV1 decoder Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 031/110] drm/amd/display: Skip to enable dsc if it has been off Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 032/110] drm/amdgpu: Add basic validation for RAS header Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 033/110] dlm: use SHUT_RDWR for SCTP shutdown Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 034/110] drm/msm/a6xx: Increase HFI response timeout Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 035/110] drm/amd/display: Do Not Consider DSC if Valid Config Not Found Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 036/110] media: i2c: imx334: Fix runtime PM handling in remove function Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 037/110] drm/amdgpu/gfx10: fix CSIB handling Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 038/110] drm: panel-orientation-quirks: Add ZOTAC Gaming Zone Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 039/110] media: ccs-pll: Better validate VT PLL branch Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 040/110] media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 041/110] drm/amd/display: fix zero value for APU watermark_c Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 042/110] drm/ttm/tests: fix incorrect assert in ttm_bo_unreserve_bulk() Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 043/110] drm/amdgpu/gfx7: fix CSIB handling Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 044/110] drm/xe: Use copy_from_user() instead of __copy_from_user() Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 045/110] ext4: ext4: unify EXT4_EX_NOCACHE|NOFAIL flags in ext4_ext_remove_space() Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 046/110] jfs: fix array-index-out-of-bounds read in add_missing_indices Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 047/110] media: ti: cal: Fix wrong goto on error path Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 048/110] drm/xe/vf: Fix guc_info debugfs for VFs Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 049/110] drm/amd/display: Update IPS sequential_ono requirement checks Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 050/110] drm/amd/display: Correct SSC enable detection for DCN351 Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 051/110] drm/amd/display: Fix Vertical Interrupt definitions for dcn32, dcn401 Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 052/110] media: rkvdec: h264: Use bytesperline and buffer height as virstride Sasha Levin
2025-06-02 5:31 ` Greg KH
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 053/110] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 054/110] media: rkvdec: Initialize the m2m context before the controls Sasha Levin
2025-06-02 13:00 ` Nicolas Dufresne
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 055/110] drm/amdgpu: fix MES GFX mask Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 056/110] drm/amdgpu: Disallow partition query during reset Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 057/110] sunrpc: fix race in cache cleanup causing stale nextcheck time Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 058/110] ext4: prevent stale extent cache entries caused by concurrent get es_cache Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 059/110] drm/amdgpu/gfx8: fix CSIB handling Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 060/110] drm/amd/display: disable EASF narrow filter sharpening Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 061/110] drm/amdgpu/gfx9: fix CSIB handling Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 062/110] drm/amd/display: Fix VUpdate offset calculations for dcn401 Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 063/110] jfs: Fix null-ptr-deref in jfs_ioc_trim Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 064/110] drm/amd/pm: Reset SMU v13.0.x custom settings Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 065/110] drm/amd/display: Correct prefetch calculation Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 066/110] drm/amd/display: Restructure DMI quirks Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 067/110] media: renesas: vsp1: Fix media bus code setup on RWPF source pad Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 068/110] drm/msm/dpu: don't select single flush for active CTL blocks Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 069/110] drm/amdkfd: Set SDMA_RLCx_IB_CNTL/SWITCH_INSIDE_IB Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 070/110] media: tc358743: ignore video while HPD is low Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 071/110] media: platform: exynos4-is: Add hardware sync wait to fimc_is_hw_change_mode() Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 072/110] media: i2c: imx334: update mode_3840x2160_regs array Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 073/110] nios2: force update_mmu_cache on spurious tlb-permission--related pagefaults Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 074/110] media: rcar-vin: Fix stride setting for RAW8 formats Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 075/110] drm/rockchip: vop2: Make overlay layer select register configuration take effect by vsync Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 076/110] drm/amdgpu: Add indirect L1_TLB_CNTL reg programming for VFs Sasha Levin
2025-06-01 23:23 ` [PATCH AUTOSEL 6.15 077/110] drm/xe/uc: Remove static from loop variable Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 078/110] media: qcom: venus: Fix uninitialized variable warning Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 079/110] drm/panel: simple: Add POWERTIP PH128800T004-ZZA01 panel entry Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 080/110] Make 'cc-option' work correctly for the -Wno-xyzzy pattern Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 081/110] ACPI: bus: Bail out if acpi_kobj registration fails Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 082/110] selftests: harness: Mark functions without prototypes static Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 083/110] pmdomain: ti: Fix STANDBY handling of PER power domain Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 084/110] PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 085/110] ASoC: amd: yc: Add quirk for Lenovo Yoga Pro 7 14ASP9 Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 086/110] thermal/drivers/qcom/tsens: Update conditions to strictly evaluate for IP v2+ Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 087/110] clocksource/drivers/timer-tegra186: Fix watchdog self-pinging Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 088/110] ALSA: hda/realtek: Add support for Acer Helios Laptops using CS35L41 HDA Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 089/110] gpio: pxa: Make irq_chip immutable Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 090/110] gpio: grgpio: " Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 091/110] gpio: xgene-sb: " Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 092/110] genirq: Retain disable depth for managed interrupts across CPU hotplug Sasha Levin
2025-06-06 12:32 ` Johan Hovold
2025-06-18 15:11 ` Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 093/110] mmc: sdhci-esdhc-imx: reset async FIFO before sending manual tuning command Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 094/110] mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 095/110] mmc: Add quirk to disable DDR50 tuning Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 096/110] ASoC: intel/sdw_utils: Assign initial value in asoc_sdw_rt_amp_spk_rtd_init() Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 097/110] clocksource: Fix the CPUs' choice in the watchdog per CPU verification Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 098/110] ACPICA: Avoid sequence overread in call to strncmp() Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 099/110] ACPICA: utilities: Fix overflow check in vsnprintf() Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 100/110] ACPI: EC: Add device to acpi_ec_no_wakeup[] qurik list Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 101/110] ALSA: seq: Remove unused snd_seq_queue_client_leave_cells Sasha Levin
2025-06-01 23:51 ` Dr. David Alan Gilbert
2025-06-18 15:12 ` Sasha Levin
2025-06-18 16:19 ` Dr. David Alan Gilbert
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 102/110] spi: axi-spi-engine: wait for completion in setup Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 103/110] cpufreq: Force sync policy boost with global boost on sysfs update Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 104/110] power: supply: bq27xxx: Retrieve again when busy Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 105/110] pmdomain: core: Reset genpd->states to avoid freeing invalid data Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 106/110] tools/nolibc: use intmax definitions from compiler Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 107/110] EDAC/igen6: Skip absent memory controllers Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 108/110] gpio: ds4520: don't check the 'ngpios' property in the driver Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 109/110] ASoC: simple-card-utils: fixup dlc->xxx handling for error case Sasha Levin
2025-06-01 23:24 ` [PATCH AUTOSEL 6.15 110/110] ASoC: tas2770: Power cycle amp on ISENSE/VSENSE change Sasha Levin
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=20250601232435.3507697-22-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=hverkuil@xs4all.nl \
--cc=kflin@nuvoton.com \
--cc=kwliu@nuvoton.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=zhang971090220@gmail.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 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).