diff options
| author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2025-10-15 10:53:24 +0300 |
|---|---|---|
| committer | Hans Verkuil <hverkuil+cisco@kernel.org> | 2025-10-17 11:31:14 +0200 |
| commit | 3662b54c16924b03197ec80f9764aabdf2c90231 (patch) | |
| tree | d692f1fc8acedf836453df5b5c264a5a8b89d387 /include | |
| parent | 082b86919b7a94de01d849021b4da820a6cb89dc (diff) | |
media: v4l2-mem2mem: Document that v4l2_m2m_get_vq() never returns NULL
The v4l2_m2m_get_vq() never returns a NULL pointer, as the internal
get_queue_ctx() helper always returns a non-NULL pointer. Many drivers
check the return value against NULL, due to a combination of old code
and cargo-cult programming. Even v4l2-mem2mem.c contains unneeded NULL
checks.
Clarify the API by documenting explicitly that a NULL check is not
needed, and simplify the code by removing the unneeded NULL checks from
v4l2-mem2mem.c.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/media/v4l2-mem2mem.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 500f81f399df..c82445929c68 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -153,6 +153,9 @@ void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); * * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx * @type: type of the V4L2 buffer, as defined by enum &v4l2_buf_type + * + * This function returns the capture queue when @type is a capture type, and the + * output queue otherwise. It never returns a NULL pointer. */ struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); |
