Skip to content

Commit 2c7f7a3

Browse files
ribaldaHans Verkuil
authored andcommitted
media: v4l: async: refactor v4l2_async_create_ancillary_links
Return 0 without checking IS_ERR or PTR_ERR if CONFIG_MEDIA_CONTROLLER is not enabled. This makes cocci happier: drivers/media/v4l2-core/v4l2-async.c:331:23-30: ERROR: PTR_ERR applied after initialization to constant on line 319 Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 8a09bb1 commit 2c7f7a3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/media/v4l2-core/v4l2-async.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,19 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier);
316316
static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n,
317317
struct v4l2_subdev *sd)
318318
{
319-
struct media_link *link = NULL;
320-
321319
#if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)
320+
struct media_link *link;
322321

323322
if (sd->entity.function != MEDIA_ENT_F_LENS &&
324323
sd->entity.function != MEDIA_ENT_F_FLASH)
325324
return 0;
326325

327326
link = media_create_ancillary_link(&n->sd->entity, &sd->entity);
328327

329-
#endif
330-
331328
return IS_ERR(link) ? PTR_ERR(link) : 0;
329+
#else
330+
return 0;
331+
#endif
332332
}
333333

334334
static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,

0 commit comments

Comments
 (0)