From 239f9a4d9868ceb8e71804dfd03d7e6bbc1658e2 Mon Sep 17 00:00:00 2001 From: fly1ngpengu1ns Date: Tue, 4 Apr 2023 03:21:08 +0000 Subject: [PATCH] Fixed fault handler when ctrl_hdlr is NULL Signed-off-by: fly1ngpengu1ns --- platform/mipi_csi/mipi_v4l2_adapter.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/mipi_csi/mipi_v4l2_adapter.c b/platform/mipi_csi/mipi_v4l2_adapter.c index d3eb584..f49d5a9 100644 --- a/platform/mipi_csi/mipi_v4l2_adapter.c +++ b/platform/mipi_csi/mipi_v4l2_adapter.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -254,11 +255,17 @@ static int LinuxInitControls(struct AdapterDrvData *drvData) ImgRect *rect = &(drvData->attr->imgRect); if (ctrl_hdlr == NULL) { + ctrl_hdlr = kzalloc(sizeof(*ctrl_hdlr), GFP_KERNEL); + if (!ctrl_hdlr) { + HDF_LOGE("%s: [kzalloc] failed.", __func__); + return -ENOMEM; + } ret = v4l2_ctrl_handler_init(ctrl_hdlr, CTRLS_COUNT); if (ret) { HDF_LOGE("%s: [v4l2_ctrl_handler_init] failed.", __func__); return ret; } + camera->ctrl_handler = ctrl_hdlr; } ctrl_hdlr->lock = &drvData->mutex; if (camera->link_freq == NULL) { -- Gitee