[PATCH 2/2] platform/raspberrypi: vchiq-mmal: Fix warnings in the zero-copy path
From: Jai Luthra
Date: Mon Nov 16 2026 - 08:33:35 EST
Fix minor issues reported by sparse and smatch around the zero-copy
support added in mmal-vchiq.
If there is no handle present vc_sm_cma_get_vc_handle() might fail,
which we check but end up printing and returing the value of the
undefined `ret` variable. Fix it by returning -EINVAL and dropping `ret`
from the print.
While at it, also fix the stale reference to the function name
"vc_sm_int_handle" in the error print, which was renamed to
"vc_sm_cma_get_vc_handle".
Secondly, during cleanup assign NULL instead of 0 to buf->vcsm_handle,
which is a pointer.
Fixes: 67d0fbe47f8a ("platform/raspberrypi: vchiq-mmal: Use vc-sm-cma to support zero copy")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <error27@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202611141210.9hmxzD2V-lkp@xxxxxxxxx/
Closes: https://lore.kernel.org/r/202611141218.5FZTnFtc-lkp@xxxxxxxxx/
Signed-off-by: Jai Luthra <jai.luthra@xxxxxxxxxxxxxxxx>
---
drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c b/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c
index 8d765aa7ea12..46803ef1e071 100644
--- a/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c
@@ -1644,10 +1644,10 @@ int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance,
buffer->vc_handle = vc_sm_cma_get_vc_handle(buffer->vcsm_handle);
if (!buffer->vc_handle) {
- pr_err("%s: vc_sm_int_handle failed %d\n",
- __func__, ret);
+ pr_err("%s: vc_sm_cma_get_vc_handle failed\n",
+ __func__);
vc_sm_cma_free(buffer->vcsm_handle);
- return ret;
+ return -EINVAL;
}
pr_debug("%s: import dmabuf %p - got vc handle %08X\n",
__func__, buffer->dma_buf, buffer->vc_handle);
@@ -1694,7 +1694,7 @@ int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf)
ret = vc_sm_cma_free(buf->vcsm_handle);
if (ret)
pr_err("%s: vcsm_free failed, ret %d\n", __func__, ret);
- buf->vcsm_handle = 0;
+ buf->vcsm_handle = NULL;
}
return 0;
}
--
2.56.0