linux/drivers/media/common
Zile Xiong a562d6dc86 media: vb2: use ssize_t for vb2_read/vb2_write
vb2_read() and vb2_write() return size_t, but propagate
negative errno values from __vb2_perform_fileio().

This relies on implicit signed/unsigned conversions in callers
(e.g. vb2_fop_read()) to recover error codes:

    __vb2_perform_fileio() -> -EINVAL
    vb2_read()             -> (size_t)-EINVAL
    vb2_fop_read()         -> -EINVAL

This relies on implicit conversions that are not obvious.

These helpers are exported (EXPORT_SYMBOL_GPL) and part of the
vb2 API, so changing their return type may affect existing users.

However, they conceptually follow read/write semantics, where
ssize_t is typically used to return either a byte count or a
negative error code.

Switch vb2_read() and vb2_write() to ssize_t, and update
__vb2_perform_fileio() accordingly.

Signed-off-by: Zile Xiong <xiongzile99@gmail.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Fixes: b25748fe61 ("[media] v4l: videobuf2: add read() and write() emulator")
Cc: stable@vger.kernel.org
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-05-06 09:05:56 +02:00
..
b2c2 media: remove unnecessary module_init/exit functions 2026-03-11 01:05:37 +01:00
saa7146 media: remove unnecessary module_init/exit functions 2026-03-11 01:05:37 +01:00
siano media: rc: fix race between unregister and urb/irq callbacks 2026-03-17 14:43:56 +01:00
v4l2-tpg media: v4l2-tpg: use (t,l)/wxh format for rectangle 2025-03-05 10:43:27 +01:00
videobuf2 media: vb2: use ssize_t for vb2_read/vb2_write 2026-05-06 09:05:56 +02:00
cx2341x.c media: update Hans Verkuil's email address 2025-09-09 15:59:02 +02:00
cypress_firmware.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cypress_firmware.h
Kconfig media updates for v6.3-rc1 2023-02-26 11:47:26 -08:00
Makefile media updates for v6.3-rc1 2023-02-26 11:47:26 -08:00
ttpci-eeprom.c media: move ttpci-eeprom to common 2021-06-02 11:16:15 +02:00
ttpci-eeprom.h media: move ttpci-eeprom to common 2021-06-02 11:16:15 +02:00
tveeprom.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
uvc.c media: uvcvideo: Add support for P010 pixel format 2026-03-25 09:40:28 +01:00