media: atomisp: Properly stop the ISP stream on sensor streamon errors
authorHans de Goede <hansg@kernel.org>
Fri, 4 Jul 2025 09:20:46 +0000 (11:20 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 8 Jul 2025 06:43:28 +0000 (08:43 +0200)
commit41dd1f2fac325bdc39318665a91040097b2cd26c
tree2ed5f7dbaff218fd8dd6a8d4bb5ebb9b188c980c
parent0a345630c980b6a274d9d4b1e9fd833bfc1a6959
media: atomisp: Properly stop the ISP stream on sensor streamon errors

When v4l2_subdev_call(sensor, s_stream, 1) fails atomisp_start_streaming()
was not properly returning the buffer ownership back to the videobuf2-core
code, resulting in:

[ 1318.153447] ------------[ cut here ]------------
[ 1318.153499] WARNING: CPU: 0 PID: 4856 at drivers/media/common/videobuf2/videobuf2-core.c:1803 vb2_start_streaming+0xcb/0x160 [videobuf2_common]
...
[ 1318.154551] Call Trace:
[ 1318.154560]  <TASK>
[ 1318.154571]  ? __warn.cold+0xb7/0x14a
[ 1318.154591]  ? vb2_start_streaming+0xcb/0x160 [videobuf2_common]
[ 1318.154617]  ? report_bug+0xe0/0x180
[ 1318.154640]  ? handle_bug+0x5e/0xa0
[ 1318.154652]  ? exc_invalid_op+0x14/0x70
[ 1318.154665]  ? asm_exc_invalid_op+0x16/0x20
[ 1318.154697]  ? vb2_start_streaming+0xcb/0x160 [videobuf2_common]
[ 1318.154723]  ? vb2_start_streaming+0x70/0x160 [videobuf2_common]
[ 1318.154748]  vb2_core_streamon+0xa2/0x100 [videobuf2_common]

The sensor streamon call is the last thing that atomisp_start_streaming()
does and it was failing to undo all of the previous steps in general.

Refactor atomisp_stop_streaming() into an atomisp_stop_stream() helper and
call that on sensor streamon failure to properly clean things up.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250505210008.152659-3-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_ioctl.c