From: Mauro Carvalho Chehab Date: Mon, 8 Nov 2021 09:40:25 +0000 (+0000) Subject: media: atomisp: only initialize mode if pipe is not null X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e5e59f81840be21c6c996c783effb8744958414e;p=uclinux-h8%2Flinux.git media: atomisp: only initialize mode if pipe is not null During atomisp register, udev tries to open all devices. For some, pipe is NULL, at least during register time, causing the driver to try to access a NULL pointer. So, add an extra check to avoid such condition. Link: https://lore.kernel.org/linux-media/6406265f2d5f3791d5c7cbd1364186217f19524c.1636364423.git.mchehab+huawei@kernel.org Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index a57d480820bd..c7ac313a2edf 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -901,7 +901,7 @@ done: rt_mutex_unlock(&isp->mutex); /* Ensure that a mode is set */ - if (asd) + if (asd && pipe) v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode); return 0;