* [PATCH v2 0/2] drm: fix some bridge api misunderstandings
@ 2018-08-06 6:19 Peter Rosin
2018-08-06 6:19 ` [PATCH v2 1/2] drm/sti: do not remove the drm_bridge that was never added Peter Rosin
2018-08-06 6:19 ` [PATCH v2 2/2] drm: bridge: document bridge attach/detach imbalance Peter Rosin
0 siblings, 2 replies; 6+ messages in thread
From: Peter Rosin @ 2018-08-06 6:19 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Rosin, Gustavo Padovan, Maarten Lankhorst, Sean Paul,
David Airlie, Benjamin Gaignard, Vincent Abriou, dri-devel,
Daniel Vetter
Hi!
The first patch was forgotten, so I improved the commit message based
on the discussion from last time, and then added a patch with a
requested documentation update.
See https://lkml.org/lkml/2018/5/2/81
Cheers,
Peter
Peter Rosin (2):
drm/sti: do not remove the drm_bridge that was never added
drm: bridge: document bridge attach/detach imbalance
drivers/gpu/drm/drm_bridge.c | 4 ++++
drivers/gpu/drm/sti/sti_hda.c | 1 -
drivers/gpu/drm/sti/sti_hdmi.c | 1 -
3 files changed, 4 insertions(+), 2 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] drm/sti: do not remove the drm_bridge that was never added
2018-08-06 6:19 [PATCH v2 0/2] drm: fix some bridge api misunderstandings Peter Rosin
@ 2018-08-06 6:19 ` Peter Rosin
2018-08-07 13:37 ` Benjamin Gaignard
2018-08-06 6:19 ` [PATCH v2 2/2] drm: bridge: document bridge attach/detach imbalance Peter Rosin
1 sibling, 1 reply; 6+ messages in thread
From: Peter Rosin @ 2018-08-06 6:19 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Rosin, Gustavo Padovan, Maarten Lankhorst, Sean Paul,
David Airlie, Benjamin Gaignard, Vincent Abriou, dri-devel,
Daniel Vetter
Removing the drm_bridge_remove call should avoid a NULL dereference
during list processing in drm_bridge_remove if the error path is ever
taken.
The more natural approach would perhaps be to add a drm_bridge_add,
but there are several other bridges that never call drm_bridge_add.
Just removing the drm_bridge_remove is the easier fix.
Fixes: 84601dbdea36 ("drm: sti: rework init sequence")
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/gpu/drm/sti/sti_hda.c | 1 -
drivers/gpu/drm/sti/sti_hdmi.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 67bbdb49fffc..199db13f565c 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -721,7 +721,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
return 0;
err_sysfs:
- drm_bridge_remove(bridge);
return -EINVAL;
}
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 58f431102512..932724784942 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1315,7 +1315,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
return 0;
err_sysfs:
- drm_bridge_remove(bridge);
hdmi->drm_connector = NULL;
return -EINVAL;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] drm: bridge: document bridge attach/detach imbalance
2018-08-06 6:19 [PATCH v2 0/2] drm: fix some bridge api misunderstandings Peter Rosin
2018-08-06 6:19 ` [PATCH v2 1/2] drm/sti: do not remove the drm_bridge that was never added Peter Rosin
@ 2018-08-06 6:19 ` Peter Rosin
2018-09-13 9:31 ` Andrzej Hajda
1 sibling, 1 reply; 6+ messages in thread
From: Peter Rosin @ 2018-08-06 6:19 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Rosin, Gustavo Padovan, Maarten Lankhorst, Sean Paul,
David Airlie, Benjamin Gaignard, Vincent Abriou, dri-devel,
Daniel Vetter
Since 4a878c03d562 ("drm: bridge: Detach bridge from encoder at encoder
cleanup time"), it is generally no longer correct to detach bridges from
encoders manually. Document that.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/gpu/drm/drm_bridge.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 1638bfe9627c..ba7025041e46 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -104,6 +104,10 @@ EXPORT_SYMBOL(drm_bridge_remove);
* If non-NULL the previous bridge must be already attached by a call to this
* function.
*
+ * Note that bridges attached to encoders are auto-detached during encoder
+ * cleanup in drm_encoder_cleanup(), so drm_bridge_attach() should generally
+ * *not* be balanced with a drm_bridge_detach() in driver code.
+ *
* RETURNS:
* Zero on success, error code on failure
*/
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] drm/sti: do not remove the drm_bridge that was never added
2018-08-06 6:19 ` [PATCH v2 1/2] drm/sti: do not remove the drm_bridge that was never added Peter Rosin
@ 2018-08-07 13:37 ` Benjamin Gaignard
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Gaignard @ 2018-08-07 13:37 UTC (permalink / raw)
To: Peter Rosin
Cc: Linux Kernel Mailing List, Gustavo Padovan, Maarten Lankhorst,
Sean Paul, David Airlie, Vincent Abriou, ML dri-devel,
Daniel Vetter
2018-08-06 8:19 GMT+02:00 Peter Rosin <peda@axentia.se>:
> Removing the drm_bridge_remove call should avoid a NULL dereference
> during list processing in drm_bridge_remove if the error path is ever
> taken.
>
> The more natural approach would perhaps be to add a drm_bridge_add,
> but there are several other bridges that never call drm_bridge_add.
> Just removing the drm_bridge_remove is the easier fix.
>
> Fixes: 84601dbdea36 ("drm: sti: rework init sequence")
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Peter Rosin <peda@axentia.se>
Pushed on drm-misc-next,
Thanks,
Benjamin
> ---
> drivers/gpu/drm/sti/sti_hda.c | 1 -
> drivers/gpu/drm/sti/sti_hdmi.c | 1 -
> 2 files changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index 67bbdb49fffc..199db13f565c 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -721,7 +721,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
> return 0;
>
> err_sysfs:
> - drm_bridge_remove(bridge);
> return -EINVAL;
> }
>
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 58f431102512..932724784942 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -1315,7 +1315,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
> return 0;
>
> err_sysfs:
> - drm_bridge_remove(bridge);
> hdmi->drm_connector = NULL;
> return -EINVAL;
> }
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm: bridge: document bridge attach/detach imbalance
2018-08-06 6:19 ` [PATCH v2 2/2] drm: bridge: document bridge attach/detach imbalance Peter Rosin
@ 2018-09-13 9:31 ` Andrzej Hajda
0 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-09-13 9:31 UTC (permalink / raw)
To: Peter Rosin, linux-kernel; +Cc: David Airlie, dri-devel, Vincent Abriou
On 06.08.2018 08:19, Peter Rosin wrote:
> Since 4a878c03d562 ("drm: bridge: Detach bridge from encoder at encoder
> cleanup time"), it is generally no longer correct to detach bridges from
> encoders manually. Document that.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> drivers/gpu/drm/drm_bridge.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 1638bfe9627c..ba7025041e46 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -104,6 +104,10 @@ EXPORT_SYMBOL(drm_bridge_remove);
> * If non-NULL the previous bridge must be already attached by a call to this
> * function.
> *
> + * Note that bridges attached to encoders are auto-detached during encoder
> + * cleanup in drm_encoder_cleanup(), so drm_bridge_attach() should generally
> + * *not* be balanced with a drm_bridge_detach() in driver code.
> + *
> * RETURNS:
> * Zero on success, error code on failure
> */
Pushed to drm-misc-next.
--
Regards
Andrzej
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm: bridge: document bridge attach/detach imbalance
@ 2018-09-13 9:31 ` Andrzej Hajda
0 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-09-13 9:31 UTC (permalink / raw)
To: Peter Rosin, linux-kernel; +Cc: David Airlie, Vincent Abriou, dri-devel
On 06.08.2018 08:19, Peter Rosin wrote:
> Since 4a878c03d562 ("drm: bridge: Detach bridge from encoder at encoder
> cleanup time"), it is generally no longer correct to detach bridges from
> encoders manually. Document that.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> drivers/gpu/drm/drm_bridge.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 1638bfe9627c..ba7025041e46 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -104,6 +104,10 @@ EXPORT_SYMBOL(drm_bridge_remove);
> * If non-NULL the previous bridge must be already attached by a call to this
> * function.
> *
> + * Note that bridges attached to encoders are auto-detached during encoder
> + * cleanup in drm_encoder_cleanup(), so drm_bridge_attach() should generally
> + * *not* be balanced with a drm_bridge_detach() in driver code.
> + *
> * RETURNS:
> * Zero on success, error code on failure
> */
Pushed to drm-misc-next.
--
Regards
Andrzej
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-09-13 9:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-06 6:19 [PATCH v2 0/2] drm: fix some bridge api misunderstandings Peter Rosin
2018-08-06 6:19 ` [PATCH v2 1/2] drm/sti: do not remove the drm_bridge that was never added Peter Rosin
2018-08-07 13:37 ` Benjamin Gaignard
2018-08-06 6:19 ` [PATCH v2 2/2] drm: bridge: document bridge attach/detach imbalance Peter Rosin
2018-09-13 9:31 ` Andrzej Hajda
2018-09-13 9:31 ` Andrzej Hajda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.