* [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls
@ 2017-01-03 13:12 Kieran Bingham
2017-01-03 13:36 ` Laurent Pinchart
0 siblings, 1 reply; 7+ messages in thread
From: Kieran Bingham @ 2017-01-03 13:12 UTC (permalink / raw)
To: sakari.ailus, laurent.pinchart, mchehab
Cc: linux-media, linux-renesas-soc, Kieran Bingham
Drivers must not perform unbalanced calls to stop the entity pipeline,
however if they do they will fault in the core media code, as the
entity->pipe will be set as NULL. We handle this gracefully in the core
with a WARN for the developer.
Replace the erroneous check on zero streaming counts, with a check on
NULL pipe elements instead, as this is the symptom of unbalanced
media_pipeline_stop calls.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
drivers/media/media-entity.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index caa13e6f09f5..cb1fb2c17f85 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -534,8 +534,13 @@ void __media_pipeline_stop(struct media_entity *entity)
struct media_graph *graph = &entity->pipe->graph;
struct media_pipeline *pipe = entity->pipe;
+ /*
+ * If the following check fails, the driver has performed an
+ * unbalanced call to media_pipeline_stop()
+ */
+ if (WARN_ON(!pipe))
+ return;
- WARN_ON(!pipe->streaming_count);
media_graph_walk_start(graph, entity);
while ((entity = media_graph_walk_next(graph))) {
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls
2017-01-03 13:12 [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls Kieran Bingham
@ 2017-01-03 13:36 ` Laurent Pinchart
2017-01-03 17:05 ` Kieran Bingham
0 siblings, 1 reply; 7+ messages in thread
From: Laurent Pinchart @ 2017-01-03 13:36 UTC (permalink / raw)
To: Kieran Bingham; +Cc: sakari.ailus, mchehab, linux-media, linux-renesas-soc
Hi Kieran,
Thank you for the patch.
On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote:
> Drivers must not perform unbalanced calls to stop the entity pipeline,
> however if they do they will fault in the core media code, as the
> entity->pipe will be set as NULL. We handle this gracefully in the core
> with a WARN for the developer.
>
> Replace the erroneous check on zero streaming counts, with a check on
> NULL pipe elements instead, as this is the symptom of unbalanced
> media_pipeline_stop calls.
>
> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
This looks good to me,
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
I'll let Sakari review and merge the patch.
> ---
> drivers/media/media-entity.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index caa13e6f09f5..cb1fb2c17f85 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -534,8 +534,13 @@ void __media_pipeline_stop(struct media_entity *entity)
> struct media_graph *graph = &entity->pipe->graph;
> struct media_pipeline *pipe = entity->pipe;
>
> + /*
> + * If the following check fails, the driver has performed an
> + * unbalanced call to media_pipeline_stop()
> + */
> + if (WARN_ON(!pipe))
> + return;
>
> - WARN_ON(!pipe->streaming_count);
> media_graph_walk_start(graph, entity);
>
> while ((entity = media_graph_walk_next(graph))) {
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls
2017-01-03 13:36 ` Laurent Pinchart
@ 2017-01-03 17:05 ` Kieran Bingham
2017-01-04 8:57 ` Sakari Ailus
0 siblings, 1 reply; 7+ messages in thread
From: Kieran Bingham @ 2017-01-03 17:05 UTC (permalink / raw)
To: Kieran Bingham, sakari.ailus
Cc: Laurent Pinchart, mchehab, linux-media, linux-renesas-soc
On 03/01/17 13:36, Laurent Pinchart wrote:
> Hi Kieran,
>
> Thank you for the patch.
>
> On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote:
>> Drivers must not perform unbalanced calls to stop the entity pipeline,
>> however if they do they will fault in the core media code, as the
>> entity->pipe will be set as NULL. We handle this gracefully in the core
>> with a WARN for the developer.
>>
>> Replace the erroneous check on zero streaming counts, with a check on
>> NULL pipe elements instead, as this is the symptom of unbalanced
>> media_pipeline_stop calls.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>
> This looks good to me,
>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> I'll let Sakari review and merge the patch.
Ahh, yes - I forgot to mention, although perhaps it will be obvious for
Sakari - but this patch is based on top of Sakari's pending media
pipeline and graph walk cleanup series :D
--
Regards
Kieran
>
>> ---
>> drivers/media/media-entity.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
>> index caa13e6f09f5..cb1fb2c17f85 100644
>> --- a/drivers/media/media-entity.c
>> +++ b/drivers/media/media-entity.c
>> @@ -534,8 +534,13 @@ void __media_pipeline_stop(struct media_entity *entity)
>> struct media_graph *graph = &entity->pipe->graph;
>> struct media_pipeline *pipe = entity->pipe;
>>
>> + /*
>> + * If the following check fails, the driver has performed an
>> + * unbalanced call to media_pipeline_stop()
>> + */
>> + if (WARN_ON(!pipe))
>> + return;
>>
>> - WARN_ON(!pipe->streaming_count);
>> media_graph_walk_start(graph, entity);
>>
>> while ((entity = media_graph_walk_next(graph))) {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls
2017-01-03 17:05 ` Kieran Bingham
@ 2017-01-04 8:57 ` Sakari Ailus
2017-05-05 17:33 ` Kieran Bingham
0 siblings, 1 reply; 7+ messages in thread
From: Sakari Ailus @ 2017-01-04 8:57 UTC (permalink / raw)
To: Kieran Bingham
Cc: Kieran Bingham, Laurent Pinchart, mchehab, linux-media,
linux-renesas-soc
Hi Kieran,
Thanks for the patch!
On Tue, Jan 03, 2017 at 05:05:58PM +0000, Kieran Bingham wrote:
> On 03/01/17 13:36, Laurent Pinchart wrote:
> > Hi Kieran,
> >
> > Thank you for the patch.
> >
> > On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote:
> >> Drivers must not perform unbalanced calls to stop the entity pipeline,
> >> however if they do they will fault in the core media code, as the
> >> entity->pipe will be set as NULL. We handle this gracefully in the core
> >> with a WARN for the developer.
> >>
> >> Replace the erroneous check on zero streaming counts, with a check on
> >> NULL pipe elements instead, as this is the symptom of unbalanced
> >> media_pipeline_stop calls.
> >>
> >> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> >
> > This looks good to me,
> >
> > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > I'll let Sakari review and merge the patch.
>
> Ahh, yes - I forgot to mention, although perhaps it will be obvious for
> Sakari - but this patch is based on top of Sakari's pending media
> pipeline and graph walk cleanup series :D
I've applied this on top of the other patches.
It's always good to mention dependencies to other patches, that's very
relevant for reviewers.
--
Regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls
2017-01-04 8:57 ` Sakari Ailus
@ 2017-05-05 17:33 ` Kieran Bingham
2017-05-05 21:11 ` Sakari Ailus
0 siblings, 1 reply; 7+ messages in thread
From: Kieran Bingham @ 2017-05-05 17:33 UTC (permalink / raw)
To: Sakari Ailus, mchehab
Cc: Kieran Bingham, Laurent Pinchart, linux-media, linux-renesas-soc
Hi Sakari,
On 04/01/17 08:57, Sakari Ailus wrote:
> Hi Kieran,
>
> Thanks for the patch!
>
> On Tue, Jan 03, 2017 at 05:05:58PM +0000, Kieran Bingham wrote:
>> On 03/01/17 13:36, Laurent Pinchart wrote:
>>> Hi Kieran,
>>>
>>> Thank you for the patch.
>>>
>>> On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote:
>>>> Drivers must not perform unbalanced calls to stop the entity pipeline,
>>>> however if they do they will fault in the core media code, as the
>>>> entity->pipe will be set as NULL. We handle this gracefully in the core
>>>> with a WARN for the developer.
>>>>
>>>> Replace the erroneous check on zero streaming counts, with a check on
>>>> NULL pipe elements instead, as this is the symptom of unbalanced
>>>> media_pipeline_stop calls.
>>>>
>>>> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>>>
>>> This looks good to me,
>>>
>>> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>>
>>> I'll let Sakari review and merge the patch.
>>
>> Ahh, yes - I forgot to mention, although perhaps it will be obvious for
>> Sakari - but this patch is based on top of Sakari's pending media
>> pipeline and graph walk cleanup series :D
>
> I've applied this on top of the other patches.
>
> It's always good to mention dependencies to other patches, that's very
> relevant for reviewers.
I've just been going through my old branches doing some clean up - and I can't
see that this patch [0] made it to integration anywhere.
Did it get lost?
It looks like the cleanup series it was based on made it through...
Mauro, perhaps you could pick this one up now ?
Regards
Kieran
[0] https://www.spinics.net/lists/linux-media/msg109715.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls
2017-05-05 17:33 ` Kieran Bingham
@ 2017-05-05 21:11 ` Sakari Ailus
2017-05-06 17:23 ` Kieran Bingham
0 siblings, 1 reply; 7+ messages in thread
From: Sakari Ailus @ 2017-05-05 21:11 UTC (permalink / raw)
To: Kieran Bingham
Cc: mchehab, Kieran Bingham, Laurent Pinchart, linux-media,
linux-renesas-soc
Hi Kieran / Mauro,
On Fri, May 05, 2017 at 06:33:22PM +0100, Kieran Bingham wrote:
> Hi Sakari,
>
> On 04/01/17 08:57, Sakari Ailus wrote:
> > Hi Kieran,
> >
> > Thanks for the patch!
> >
> > On Tue, Jan 03, 2017 at 05:05:58PM +0000, Kieran Bingham wrote:
> >> On 03/01/17 13:36, Laurent Pinchart wrote:
> >>> Hi Kieran,
> >>>
> >>> Thank you for the patch.
> >>>
> >>> On Tuesday 03 Jan 2017 13:12:11 Kieran Bingham wrote:
> >>>> Drivers must not perform unbalanced calls to stop the entity pipeline,
> >>>> however if they do they will fault in the core media code, as the
> >>>> entity->pipe will be set as NULL. We handle this gracefully in the core
> >>>> with a WARN for the developer.
> >>>>
> >>>> Replace the erroneous check on zero streaming counts, with a check on
> >>>> NULL pipe elements instead, as this is the symptom of unbalanced
> >>>> media_pipeline_stop calls.
> >>>>
> >>>> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> >>>
> >>> This looks good to me,
> >>>
> >>> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >>>
> >>> I'll let Sakari review and merge the patch.
> >>
> >> Ahh, yes - I forgot to mention, although perhaps it will be obvious for
> >> Sakari - but this patch is based on top of Sakari's pending media
> >> pipeline and graph walk cleanup series :D
> >
> > I've applied this on top of the other patches.
> >
> > It's always good to mention dependencies to other patches, that's very
> > relevant for reviewers.
>
> I've just been going through my old branches doing some clean up - and I can't
> see that this patch [0] made it to integration anywhere.
>
> Did it get lost?
> It looks like the cleanup series it was based on made it through...
What I think happened was that I had applied it to the correct branch BUT I
already had sent a pull request on it. My apologies.
>
> Mauro, perhaps you could pick this one up now ?
The patchwork link is here:
<URL:https://patchwork.linuxtv.org/patch/38883/>
--
Regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls
2017-05-05 21:11 ` Sakari Ailus
@ 2017-05-06 17:23 ` Kieran Bingham
0 siblings, 0 replies; 7+ messages in thread
From: Kieran Bingham @ 2017-05-06 17:23 UTC (permalink / raw)
To: Sakari Ailus
Cc: mchehab, Kieran Bingham, Laurent Pinchart, linux-media,
linux-renesas-soc
Hi Sakari,
>> Did it get lost?
>> It looks like the cleanup series it was based on made it through...
>
> What I think happened was that I had applied it to the correct branch BUT I
> already had sent a pull request on it. My apologies.
No worries - thanks for checking!
>
>>
>> Mauro, perhaps you could pick this one up now ?
>
> The patchwork link is here:
>
> <URL:https://patchwork.linuxtv.org/patch/38883/>
Regards
Kieran
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-05-06 17:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-03 13:12 [PATCH] media: entity: Catch unbalanced media_pipeline_stop calls Kieran Bingham
2017-01-03 13:36 ` Laurent Pinchart
2017-01-03 17:05 ` Kieran Bingham
2017-01-04 8:57 ` Sakari Ailus
2017-05-05 17:33 ` Kieran Bingham
2017-05-05 21:11 ` Sakari Ailus
2017-05-06 17:23 ` Kieran Bingham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox