[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN6PR04MB0660EE7304C2BB2E603A8824A3AE0@BN6PR04MB0660.namprd04.prod.outlook.com>
Date: Sat, 25 Apr 2020 19:26:42 -0700
From: Jonathan Bakker <xc-racer2@...e.ca>
To: kyungmin.park@...sung.com, s.nawrocki@...sung.com,
mchehab@...nel.org, kgene@...nel.org, krzk@...nel.org,
linux-media@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Jonathan Bakker <xc-racer2@...e.ca>
Subject: [PATCH 03/11] media: exynos4-is: Fix nullptr when no CSIS device present
Not all devices use the CSIS device, some may use the FIMC directly in
which case the CSIS device isn't registered. This leads to a nullptr
exception when starting the stream as the CSIS device is always
referenced. Instead, if getting the CSIS device fails, try getting the
FIMC directly to check if we are using the subdev API
Signed-off-by: Jonathan Bakker <xc-racer2@...e.ca>
---
drivers/media/platform/exynos4-is/media-dev.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index 9aaf3b8060d5..5c32abc7251b 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -289,11 +289,26 @@ static int __fimc_pipeline_s_stream(struct exynos_media_pipeline *ep, bool on)
{ IDX_CSIS, IDX_FLITE, IDX_FIMC, IDX_SENSOR, IDX_IS_ISP },
};
struct fimc_pipeline *p = to_fimc_pipeline(ep);
- struct fimc_md *fmd = entity_to_fimc_mdev(&p->subdevs[IDX_CSIS]->entity);
enum fimc_subdev_index sd_id;
int i, ret = 0;
if (p->subdevs[IDX_SENSOR] == NULL) {
+ struct fimc_md *fmd;
+ struct v4l2_subdev *sd = p->subdevs[IDX_CSIS];
+
+ if (!sd)
+ sd = p->subdevs[IDX_FIMC];
+
+ if (!sd) {
+ /*
+ * If neither CSIS nor FIMC was set up,
+ * it's impossible to have any sensors
+ */
+ return -ENODEV;
+ }
+
+ fmd = entity_to_fimc_mdev(&sd->entity);
+
if (!fmd->user_subdev_api) {
/*
* Sensor must be already discovered if we
--
2.20.1
Powered by blists - more mailing lists