summaryrefslogtreecommitdiffstats
path: root/include/media/v4l2-subdev.h
diff options
context:
space:
mode:
authorHans Verkuil2019-02-08 09:49:23 +0100
committerMauro Carvalho Chehab2019-02-18 16:58:59 +0100
commit3d769df5fc32dc3cb12d6ccb61690b09371b8b3f (patch)
tree518a7e17f442f7302846cbc3f9b3817086114174 /include/media/v4l2-subdev.h
parentmedia: vimc: Remove unused but set variables (diff)
downloadkernel-qcow2-linux-3d769df5fc32dc3cb12d6ccb61690b09371b8b3f.tar.gz
kernel-qcow2-linux-3d769df5fc32dc3cb12d6ccb61690b09371b8b3f.tar.xz
kernel-qcow2-linux-3d769df5fc32dc3cb12d6ccb61690b09371b8b3f.zip
media: v4l2-subdev.h: v4l2_subdev_call: use temp __sd variable
The sd argument of this macro can be a more complex expression. Since it is used 5 times in the macro it can be evaluated that many times as well. So assign it to a temp variable in the beginning and use that instead. This also avoids any potential side-effects of evaluating sd. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r--include/media/v4l2-subdev.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 47af609dc8f1..34da094a3f40 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -1093,13 +1093,14 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
*/
#define v4l2_subdev_call(sd, o, f, args...) \
({ \
+ struct v4l2_subdev *__sd = (sd); \
int __result; \
- if (!(sd)) \
+ if (!__sd) \
__result = -ENODEV; \
- else if (!((sd)->ops->o && (sd)->ops->o->f)) \
+ else if (!(__sd->ops->o && __sd->ops->o->f)) \
__result = -ENOIOCTLCMD; \
else \
- __result = (sd)->ops->o->f((sd), ##args); \
+ __result = __sd->ops->o->f(__sd, ##args); \
__result; \
})