[PATCH v2 09/16] video: vpl: handle missing struct vpl::ioctl gracefully
Ahmad Fatoum
a.fatoum at barebox.org
Thu Jun 5 22:57:41 PDT 2025
Display controllers don't usually implement the ioctl callback, because
they are invoked via the register_framebuffer API and only need to call
other drivers' ioctl and their own is never called.
Yet, when by mistake an ioctl is directed at a display controller, we
currently crash. Let's handle this case gracefully instead.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
drivers/video/vpl.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/video/vpl.c b/drivers/video/vpl.c
index 0b86ef9f7e81..da8bd93b7d6a 100644
--- a/drivers/video/vpl.c
+++ b/drivers/video/vpl.c
@@ -106,6 +106,7 @@ static int vpl_foreach_endpoint(struct vpl *vpl, unsigned int port,
}
struct vpl_ioctl {
+ int err;
unsigned cmd;
void *ptr;
};
@@ -114,6 +115,11 @@ static int vpl_remote_ioctl(struct vpl *vpl, unsigned port, void *_data)
{
struct vpl_ioctl *data = _data;
+ if (!vpl->ioctl) {
+ data->err = -EOPNOTSUPP;
+ return 0;
+ }
+
return vpl->ioctl(vpl, port, data->cmd, data->ptr);
}
@@ -122,5 +128,5 @@ int vpl_ioctl(struct vpl *vpl, unsigned int port,
{
struct vpl_ioctl data = { .cmd = cmd, .ptr = ptr };
- return vpl_foreach_endpoint(vpl, port, vpl_remote_ioctl, &data);
+ return vpl_foreach_endpoint(vpl, port, vpl_remote_ioctl, &data) ?: data.err;
}
--
2.39.5
More information about the barebox
mailing list