Commit 0bd79f91 authored by Douglas Anderson's avatar Douglas Anderson Committed by Sean Paul

drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries

In commit 50f9495e ("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: 50f9495e ("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus")
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Reported-by: default avatarErico Nunes <nunes.erico@gmail.com>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190610175234.196844-1-dianders@chromium.org
parent 427231bc
......@@ -256,7 +256,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");
......@@ -2691,11 +2691,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)) {
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->unwedge_state = ERR_PTR(-ENODEV);
hdmi->default_state = NULL;
hdmi->unwedge_state = NULL;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment