mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/omap: dss: fix handling deferrals
@ 2026-11-11 12:22 Andreas Kemnade
  2026-11-11 14:56 ` Tomi Valkeinen
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Kemnade @ 2026-11-11 12:22 UTC (permalink / raw)
  To: Tomi Valkeinen, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Luca Ceresoli
  Cc: dri-devel, linux-omap, hns, linux-kernel, Andreas Kemnade

Forward the error given by of_drm_get_bridge_by_endpoint() if it is
EPROBE_DEFER to ensure output gets initialized later when available.

On GTA04/OMAP3 no display was found, but it appeared after doing
rmmod omapdrm ; modprobe omapdrm

Fixes: b7e9b93fc8ecf ("drm/omap: dss: don't create a panel_bridge")
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/gpu/drm/omapdrm/dss/output.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 36d37deac8026..220ed7e003080 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -24,6 +24,11 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 
 	bridge = of_drm_get_bridge_by_endpoint(out->dev->of_node, out->of_port, 0);
 	if (IS_ERR(bridge)) {
+		if (PTR_ERR(bridge) == -EPROBE_DEFER) {
+			ret = PTR_ERR(bridge);
+			goto error;
+		}
+
 		dev_dbg(out->dev, "failed to find video sink\n");
 		return 0;
 	}

---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261111-gta04-drm-regression-fix-f7ef51c66ed3

Best regards,
--  
Andreas Kemnade <andreas@kemnade.info>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/omap: dss: fix handling deferrals
  2026-11-11 12:22 [PATCH] drm/omap: dss: fix handling deferrals Andreas Kemnade
@ 2026-11-11 14:56 ` Tomi Valkeinen
  2026-11-11 15:46   ` Luca Ceresoli
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Valkeinen @ 2026-11-11 14:56 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: dri-devel, linux-omap, hns, linux-kernel, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Luca Ceresoli

Hi,

On 11/11/2026 14:22, Andreas Kemnade wrote:
> Forward the error given by of_drm_get_bridge_by_endpoint() if it is
> EPROBE_DEFER to ensure output gets initialized later when available.
> 
> On GTA04/OMAP3 no display was found, but it appeared after doing
> rmmod omapdrm ; modprobe omapdrm
> 
> Fixes: b7e9b93fc8ecf ("drm/omap: dss: don't create a panel_bridge")
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>   drivers/gpu/drm/omapdrm/dss/output.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index 36d37deac8026..220ed7e003080 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -24,6 +24,11 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>   
>   	bridge = of_drm_get_bridge_by_endpoint(out->dev->of_node, out->of_port, 0);
>   	if (IS_ERR(bridge)) {
> +		if (PTR_ERR(bridge) == -EPROBE_DEFER) {
> +			ret = PTR_ERR(bridge);
> +			goto error;
> +		}
> +
Shouldn't we just return PTR_ERR(bridge) here? The error label will call 
omapdss_device_cleanup_output(), which cleans up things set up later in 
this function.

  Tomi


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/omap: dss: fix handling deferrals
  2026-11-11 14:56 ` Tomi Valkeinen
@ 2026-11-11 15:46   ` Luca Ceresoli
  0 siblings, 0 replies; 3+ messages in thread
From: Luca Ceresoli @ 2026-11-11 15:46 UTC (permalink / raw)
  To: Tomi Valkeinen, Andreas Kemnade
  Cc: dri-devel, linux-omap, hns, linux-kernel, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Luca Ceresoli

Hello Andreas,

On Wed Nov 11, 2026 at 3:56 PM CET, Tomi Valkeinen wrote:
> Hi,
>
> On 11/11/2026 14:22, Andreas Kemnade wrote:
>> Forward the error given by of_drm_get_bridge_by_endpoint() if it is
>> EPROBE_DEFER to ensure output gets initialized later when available.
>>
>> On GTA04/OMAP3 no display was found, but it appeared after doing
>> rmmod omapdrm ; modprobe omapdrm
>>
>> Fixes: b7e9b93fc8ecf ("drm/omap: dss: don't create a panel_bridge")

Ouch, sorry about breaking this driver. To my excuse the old code removed
by b7e9b93fc8ecf was (ans still is) pretty obscure.

>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
>> ---
>>   drivers/gpu/drm/omapdrm/dss/output.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
>> index 36d37deac8026..220ed7e003080 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/output.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
>> @@ -24,6 +24,11 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>>
>>   	bridge = of_drm_get_bridge_by_endpoint(out->dev->of_node, out->of_port, 0);
>>   	if (IS_ERR(bridge)) {
>> +		if (PTR_ERR(bridge) == -EPROBE_DEFER) {
>> +			ret = PTR_ERR(bridge);
>> +			goto error;
>> +		}
>> +
> Shouldn't we just return PTR_ERR(bridge) here? The error label will call
> omapdss_device_cleanup_output(), which cleans up things set up later in
> this function.

Indeed.


Additionally, by looking at the omapdss_device_init_output() code right
now, the goto-based error management appears:

 1. unnecessarily complicated: only one goto for only one line of rollback
    code

 2. potentially wrong, or at least doing too much, because
    omapdss_device_cleanup_output() does two things:

      a. drm_bridge_put(out->next_bridge): but when goto is invoked the
         out->next_bridge pointer has not been touched yet
         (I assume we should not touch the refcount in this case)

      b. drm_bridge_put(out->bridge): unneeded because the goto is inside
         an 'if (!out->bridge)', thus there is no reference at all to put

Do you agree with these findings?

If you do, I guess this simple patch should fix both at once (untested):

---------------------------------8<---------------------------------
@@ -31,20 +31,14 @@ int omapdss_device_init_output(struct omap_dss_device *out,
        out->bridge = bridge;

        if (local_bridge) {
-               if (!out->bridge) {
-                       ret = -EPROBE_DEFER;
-                       goto error;
-               }
+               if (!out->bridge)
+                       return -EPROBE_DEFER;

                out->next_bridge = out->bridge;
                out->bridge = drm_bridge_get(local_bridge);
        }

        return 0;
-
-error:
-       omapdss_device_cleanup_output(out);
-       return ret;
 }
---------------------------------8<---------------------------------

Can you double check this, test on hardware and if it looks correct send
that as a separate patch?

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-11 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 12:22 [PATCH] drm/omap: dss: fix handling deferrals Andreas Kemnade
2026-11-11 14:56 ` Tomi Valkeinen
2026-11-11 15:46   ` Luca Ceresoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®