diff options
| author | Muhammad Haris Awan <m.harisawan@icloud.com> | 2026-09-04 15:56:25 +0500 |
|---|---|---|
| committer | Hans Verkuil <hverkuil+cisco@kernel.org> | 2026-09-10 14:21:05 +0200 |
| commit | 75352cab0e264560da82420aaefdb818140f9cfe (patch) | |
| tree | 2f0f00a689886c0fdb582ed2f79d7bc5ab4a5086 | |
| parent | 4abbba28924962b406d5b83968727d0c88ba7806 (diff) | |
| download | linux-next-75352cab0e264560da82420aaefdb818140f9cfe.tar.gz linux-next-75352cab0e264560da82420aaefdb818140f9cfe.zip | |
media: cx25840: return -EOPNOTSUPP instead of WARN_ON in cx25840_init
cx25840_init() implements generic mode video output configuration only
for cx2584x chips. For other chips, it triggers a WARN_ON(1) and returns
0, falsely indicating successful initialization while leaving the chip
unconfigured and marking generic_mode as true.
Using WARN_ON() for unsupported hardware variants is discouraged as it
triggers kernel warnings and syzbot alerts on faulty or unsupported
devices.
Return -EOPNOTSUPP early if the chip is not a cx2584x variant so callers
(such as cxusb_medion_register_analog_subdevs()) can handle the error
cleanly.
Reported-by: syzbot+9123948aef13fe92d706@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9123948aef13fe92d706
Tested-by: syzbot+9123948aef13fe92d706@syzkaller.appspotmail.com
Signed-off-by: Muhammad Haris Awan <m.harisawan@icloud.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
[hverkuil: fixed the mangled patch]
| -rw-r--r-- | drivers/media/i2c/cx25840/cx25840-core.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c index 8b7dd43ed208..159231b80daf 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.c +++ b/drivers/media/i2c/cx25840/cx25840-core.c @@ -2289,29 +2289,27 @@ static int cx25840_init(struct v4l2_subdev *sd, u32 val) { struct cx25840_state *state = to_state(sd); + if (!is_cx2584x(state)) + return -EOPNOTSUPP; + state->generic_mode = true; - if (is_cx2584x(state)) { - /* set datasheet video output defaults */ - state->vid_config = CX25840_VCONFIG_FMT_BT656 | - CX25840_VCONFIG_RES_8BIT | - CX25840_VCONFIG_VBIRAW_DISABLED | - CX25840_VCONFIG_ANCDATA_ENABLED | - CX25840_VCONFIG_TASKBIT_ONE | - CX25840_VCONFIG_ACTIVE_HORIZONTAL | - CX25840_VCONFIG_VALID_NORMAL | - CX25840_VCONFIG_HRESETW_NORMAL | - CX25840_VCONFIG_CLKGATE_NONE | - CX25840_VCONFIG_DCMODE_DWORDS | - CX25840_VCONFIG_IDID0S_NORMAL | - CX25840_VCONFIG_VIPCLAMP_DISABLED; - - /* add additional settings */ - cx25840_vconfig_add(state, val); - } else { - /* TODO: generic mode needs to be developed for other chips */ - WARN_ON(1); - } + /* set datasheet video output defaults */ + state->vid_config = CX25840_VCONFIG_FMT_BT656 | + CX25840_VCONFIG_RES_8BIT | + CX25840_VCONFIG_VBIRAW_DISABLED | + CX25840_VCONFIG_ANCDATA_ENABLED | + CX25840_VCONFIG_TASKBIT_ONE | + CX25840_VCONFIG_ACTIVE_HORIZONTAL | + CX25840_VCONFIG_VALID_NORMAL | + CX25840_VCONFIG_HRESETW_NORMAL | + CX25840_VCONFIG_CLKGATE_NONE | + CX25840_VCONFIG_DCMODE_DWORDS | + CX25840_VCONFIG_IDID0S_NORMAL | + CX25840_VCONFIG_VIPCLAMP_DISABLED; + + /* add additional settings */ + cx25840_vconfig_add(state, val); return 0; } |
