drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries
Subsystems (4)
PATCH 1/1 drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries
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.
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +8 -6
@@ -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 ; } }
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
Quoted 11 lines · Douglas Anderson
In commit
50f9495efe30("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus") I stupidly usedIS_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 <[email protected]>Signed-off-by Douglas Anderson <[email protected]>
Thanks Erico for the report, and Doug for fixing this up quickly, I've applied the patch to drm-misc-next
Sean
Quoted 40 lines
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +8
-7@@ -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
Quoted 8 lines · Sean Paul
Quoted 6 lines · Douglas Anderson
In commit
50f9495efe30("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus") I stupidly usedIS_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.
Quoted 8 lines
Quoted 5 lines
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 <[email protected]>Signed-off-by Douglas Anderson <[email protected]>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