Commit 3d769df5 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 5515e414
...@@ -1093,13 +1093,14 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, ...@@ -1093,13 +1093,14 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
*/ */
#define v4l2_subdev_call(sd, o, f, args...) \ #define v4l2_subdev_call(sd, o, f, args...) \
({ \ ({ \
struct v4l2_subdev *__sd = (sd); \
int __result; \ int __result; \
if (!(sd)) \ if (!__sd) \
__result = -ENODEV; \ __result = -ENODEV; \
else if (!((sd)->ops->o && (sd)->ops->o->f)) \ else if (!(__sd->ops->o && __sd->ops->o->f)) \
__result = -ENOIOCTLCMD; \ __result = -ENOIOCTLCMD; \
else \ else \
__result = (sd)->ops->o->f((sd), ##args); \ __result = __sd->ops->o->f(__sd, ##args); \
__result; \ __result; \
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment