All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries
@ 2019-06-10 17:52 Douglas Anderson
  2019-06-10 20:50 ` Sean Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Douglas Anderson @ 2019-06-10 17:52 UTC (permalink / raw)
  To: Sean Paul
  Cc: linux-rockchip, Erico Nunes, heiko, Douglas Anderson,
	David Airlie, Andrzej Hajda, Jonas Karlman, linux-kernel,
	dri-devel, Sam Ravnborg, Neil Armstrong, Ville Syrjälä,
	Thomas Gleixner, Laurent Pinchart, Daniel Vetter

In commit 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge"
for ddc bus") I stupidly used IS_ERR() to check for whether we have an
"unwedge" pinctrl state even though on most flows through the driver
the unwedge state will just be NULL.

Fix it so that we consistently use NULL for no unwedge state.

Fixes: 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus")
Reported-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index f25e091b93c5..5e4e9408d00f 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -251,7 +251,7 @@ static void dw_hdmi_i2c_init(struct dw_hdmi *hdmi)
 static bool dw_hdmi_i2c_unwedge(struct dw_hdmi *hdmi)
 {
 	/* If no unwedge state then give up */
-	if (IS_ERR(hdmi->unwedge_state))
+	if (!hdmi->unwedge_state)
 		return false;
 
 	dev_info(hdmi->dev, "Attempting to unwedge stuck i2c bus\n");
@@ -2686,11 +2686,13 @@ __dw_hdmi_probe(struct platform_device *pdev,
 			hdmi->default_state =
 				pinctrl_lookup_state(hdmi->pinctrl, "default");
 
-			if (IS_ERR(hdmi->default_state) &&
-			    !IS_ERR(hdmi->unwedge_state)) {
-				dev_warn(dev,
-					 "Unwedge requires default pinctrl\n");
-				hdmi->unwedge_state = ERR_PTR(-ENODEV);
+			if (IS_ERR(hdmi->default_state) ||
+			    IS_ERR(hdmi->unwedge_state)) {
+				if (!IS_ERR(hdmi->unwedge_state))
+					dev_warn(dev,
+						 "Unwedge requires default pinctrl\n");
+				hdmi->default_state = NULL;
+				hdmi->unwedge_state = NULL;
 			}
 		}
 
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


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

* Re: [PATCH] drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries
  2019-06-10 17:52 [PATCH] drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries Douglas Anderson
@ 2019-06-10 20:50 ` Sean Paul
  2019-06-11 12:05   ` Erico Nunes
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Paul @ 2019-06-10 20:50 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Sean Paul, open list:ARM/Rockchip SoC...,
	Erico Nunes, Heiko Stuebner, David Airlie, Andrzej Hajda,
	Jonas Karlman, LKML, dri-devel, Sam Ravnborg, Neil Armstrong,
	Ville Syrjälä,
	Thomas Gleixner, Laurent Pinchart, Daniel Vetter

On Mon, Jun 10, 2019 at 1:52 PM Douglas Anderson <dianders@chromium.org> wrote:
>
> In commit 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge"
> for ddc bus") I stupidly used IS_ERR() to check for whether we have an
> "unwedge" pinctrl state even though on most flows through the driver
> the unwedge state will just be NULL.
>
> Fix it so that we consistently use NULL for no unwedge state.
>
> Fixes: 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus")
> Reported-by: Erico Nunes <nunes.erico@gmail.com>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Thanks Erico for the report, and Doug for fixing this up quickly, I've applied
the patch to drm-misc-next

Sean

> ---
>
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index f25e091b93c5..5e4e9408d00f 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -251,7 +251,7 @@ static void dw_hdmi_i2c_init(struct dw_hdmi *hdmi)
>  static bool dw_hdmi_i2c_unwedge(struct dw_hdmi *hdmi)
>  {
>         /* If no unwedge state then give up */
> -       if (IS_ERR(hdmi->unwedge_state))
> +       if (!hdmi->unwedge_state)
>                 return false;
>
>         dev_info(hdmi->dev, "Attempting to unwedge stuck i2c bus\n");
> @@ -2686,11 +2686,13 @@ __dw_hdmi_probe(struct platform_device *pdev,
>                         hdmi->default_state =
>                                 pinctrl_lookup_state(hdmi->pinctrl, "default");
>
> -                       if (IS_ERR(hdmi->default_state) &&
> -                           !IS_ERR(hdmi->unwedge_state)) {
> -                               dev_warn(dev,
> -                                        "Unwedge requires default pinctrl\n");
> -                               hdmi->unwedge_state = ERR_PTR(-ENODEV);
> +                       if (IS_ERR(hdmi->default_state) ||
> +                           IS_ERR(hdmi->unwedge_state)) {
> +                               if (!IS_ERR(hdmi->unwedge_state))
> +                                       dev_warn(dev,
> +                                                "Unwedge requires default pinctrl\n");
> +                               hdmi->default_state = NULL;
> +                               hdmi->unwedge_state = NULL;
>                         }
>                 }
>
> --
> 2.22.0.rc2.383.gf4fbbf30c2-goog
>

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

* Re: [PATCH] drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries
  2019-06-10 20:50 ` Sean Paul
@ 2019-06-11 12:05   ` Erico Nunes
  0 siblings, 0 replies; 3+ messages in thread
From: Erico Nunes @ 2019-06-11 12:05 UTC (permalink / raw)
  To: Sean Paul
  Cc: Douglas Anderson, Sean Paul, open list:ARM/Rockchip SoC...,
	Heiko Stuebner, David Airlie, Andrzej Hajda, Jonas Karlman, LKML,
	dri-devel, Sam Ravnborg, Neil Armstrong, Ville Syrjälä,
	Thomas Gleixner, Laurent Pinchart, Daniel Vetter

On Mon, Jun 10, 2019 at 10:51 PM Sean Paul <sean@poorly.run> wrote:
>
> On Mon, Jun 10, 2019 at 1:52 PM Douglas Anderson <dianders@chromium.org> wrote:
> >
> > In commit 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge"
> > for ddc bus") I stupidly used IS_ERR() to check for whether we have an
> > "unwedge" pinctrl state even though on most flows through the driver
> > the unwedge state will just be NULL.
> >
> > Fix it so that we consistently use NULL for no unwedge state.
> >
> > Fixes: 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus")
> > Reported-by: Erico Nunes <nunes.erico@gmail.com>
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
>
> Thanks Erico for the report, and Doug for fixing this up quickly, I've applied
> the patch to drm-misc-next

It does fix the issue. Thank you for the quick fix.

Erico

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

end of thread, other threads:[~2019-06-11 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10 17:52 [PATCH] drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries Douglas Anderson
2019-06-10 20:50 ` Sean Paul
2019-06-11 12:05   ` Erico Nunes

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.