* [PATCH] media: avoid skipping MEDIA_PAD_FL_MUST_CONNECT logic
@ 2019-05-31 8:06 Nikita Yushchenko
2019-05-31 10:29 ` Sakari Ailus
0 siblings, 1 reply; 2+ messages in thread
From: Nikita Yushchenko @ 2019-05-31 8:06 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil
Cc: Shuah Khan, Laurent Pinchart, linux-media, linux-kernel,
Nikita Yushchenko
In the current code, __media_pipeline_start() skips check of
MEDIA_PAD_FL_MUST_CONNECT logic for entity not providing link_validate()
op.
Fix that by checking for existence of link_validate() at different code
location.
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
drivers/media/mc/mc-entity.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
index a998a2e0ea1d..8b4912be30d1 100644
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -449,9 +449,6 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
if (entity->stream_count > 1)
continue;
- if (!entity->ops || !entity->ops->link_validate)
- continue;
-
bitmap_zero(active, entity->num_pads);
bitmap_fill(has_no_links, entity->num_pads);
@@ -479,6 +476,9 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
!(link->flags & MEDIA_LNK_FL_ENABLED))
continue;
+ if (!entity->ops || !entity->ops->link_validate)
+ continue;
+
ret = entity->ops->link_validate(link);
if (ret < 0 && ret != -ENOIOCTLCMD) {
dev_dbg(entity->graph_obj.mdev->dev,
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: avoid skipping MEDIA_PAD_FL_MUST_CONNECT logic
2019-05-31 8:06 [PATCH] media: avoid skipping MEDIA_PAD_FL_MUST_CONNECT logic Nikita Yushchenko
@ 2019-05-31 10:29 ` Sakari Ailus
0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2019-05-31 10:29 UTC (permalink / raw)
To: Nikita Yushchenko
Cc: Mauro Carvalho Chehab, Hans Verkuil, Shuah Khan,
Laurent Pinchart, linux-media, linux-kernel
Hi Nikita,
On Fri, May 31, 2019 at 11:06:37AM +0300, Nikita Yushchenko wrote:
> In the current code, __media_pipeline_start() skips check of
> MEDIA_PAD_FL_MUST_CONNECT logic for entity not providing link_validate()
> op.
>
> Fix that by checking for existence of link_validate() at different code
> location.
>
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> ---
> drivers/media/mc/mc-entity.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
> index a998a2e0ea1d..8b4912be30d1 100644
> --- a/drivers/media/mc/mc-entity.c
> +++ b/drivers/media/mc/mc-entity.c
> @@ -449,9 +449,6 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
> if (entity->stream_count > 1)
> continue;
>
> - if (!entity->ops || !entity->ops->link_validate)
> - continue;
> -
> bitmap_zero(active, entity->num_pads);
> bitmap_fill(has_no_links, entity->num_pads);
>
> @@ -479,6 +476,9 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
> !(link->flags & MEDIA_LNK_FL_ENABLED))
> continue;
>
> + if (!entity->ops || !entity->ops->link_validate)
> + continue;
> +
> ret = entity->ops->link_validate(link);
> if (ret < 0 && ret != -ENOIOCTLCMD) {
> dev_dbg(entity->graph_obj.mdev->dev,
Thanks for the patch. This generally hasn't been an issue as drivers do
implement link_validate function. But it still is a bug in the code.
The link validation function does not change during the loop. How about
caching it locally and implementing a static nop variant you call in case
there's nothing to theck, so there's no need to check for entity->ops and
the entity->ops->link_validate separately on every iteration?
--
Kind regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-31 10:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 8:06 [PATCH] media: avoid skipping MEDIA_PAD_FL_MUST_CONNECT logic Nikita Yushchenko
2019-05-31 10:29 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).