aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonathan Bakker <xc-racer2@live.ca> 2020-07-31 01:01:06 +0200
committerGravatar Mauro Carvalho Chehab <mchehab+huawei@kernel.org> 2020-09-01 14:13:25 +0200
commita1f51d37324260f16561429d77abdc1502135cfd (patch)
treecaf2eade0889bd0ebadfd7970255aacfd9263857
parentmedia: exynos4-is: Request syscon only if ISP writeback is present (diff)
downloadlinux-a1f51d37324260f16561429d77abdc1502135cfd.tar.gz
linux-a1f51d37324260f16561429d77abdc1502135cfd.tar.bz2
linux-a1f51d37324260f16561429d77abdc1502135cfd.zip
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@live.ca> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r--drivers/media/platform/exynos4-is/media-dev.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index ae74d8f72d29..aae584f9770d 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -290,11 +290,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