media: exynos4-is: Check pipe is valid before calling subdev
authorSimon Shields <simon@lineageos.org>
Mon, 27 Nov 2017 13:12:41 +0000 (08:12 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 18 Dec 2017 20:12:12 +0000 (15:12 -0500)
If the subdev is not yet present (probably because the subdev
module has not yet been loaded), the pipe will be NULL. Make sure
that this is not the case before attempting to call the op.

Signed-off-by: Simon Shields <simon@lineageos.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
include/media/drv-intf/exynos-fimc.h

index 69bcd2a07d5cd69e413e3a71bc986fd2ac8bf705..f9c64338841f1710963e8d4598d35d84f6608400 100644 (file)
@@ -155,7 +155,8 @@ static inline struct exynos_video_entity *vdev_to_exynos_video_entity(
 }
 
 #define fimc_pipeline_call(ent, op, args...)                             \
-       (!(ent) ? -ENOENT : (((ent)->pipe->ops && (ent)->pipe->ops->op) ? \
+       ((!(ent) || !(ent)->pipe) ? -ENOENT : \
+       (((ent)->pipe->ops && (ent)->pipe->ops->op) ? \
        (ent)->pipe->ops->op(((ent)->pipe), ##args) : -ENOIOCTLCMD))      \
 
 #endif /* S5P_FIMC_H_ */