All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Kemnade <andreas@kemnade.info>
To: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
Cc: "Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
	<dri-devel@lists.freedesktop.org>, <linux-omap@vger.kernel.org>,
	<hns@goldelico.com>, <linux-kernel@vger.kernel.org>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>
Subject: Re: [PATCH] drm/omap: dss: fix handling deferrals
Date: Thu, 12 Nov 2026 12:51:48 +0100	[thread overview]
Message-ID: <20261112125148.23235dec@kemnade.info> (raw)
In-Reply-To: <DMSHYXQ01R6O.3F13LZ51TUPCP@bootlin.com>

On Wed, 11 Nov 2026 16:46:51 +0100
"Luca Ceresoli" <luca.ceresoli@bootlin.com> wrote:

> 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?
> 
of_drm_get_bridge_by_endpoint never returns NULL (indicated by Sashiko).
So we have dead code there anyways. So the patch is dead code elimination
and not fixing bugs.

Regards,
Andreas

      reply	other threads:[~2026-11-12 11:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2026-11-12 11:51     ` Andreas Kemnade [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112125148.23235dec@kemnade.info \
    --to=andreas@kemnade.info \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hns@goldelico.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.