diff mbox series

[v2] gpu: anx7808: fix a missing check in anx78xx_poweron

Message ID 20181225051720.66433-1-kjlu@umn.edu (mailing list archive)
State New, archived
Headers show
Series [v2] gpu: anx7808: fix a missing check in anx78xx_poweron | expand

Commit Message

Kangjie Lu Dec. 25, 2018, 5:17 a.m. UTC
Both anx78xx_set_bits() and anx78xx_clear_bits() in the poweron process
may fail. The fix inserts checks for their return values.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/gpu/drm/bridge/analogix-anx78xx.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c
index f8433c93f463..3b0fe2b188db 100644
--- a/drivers/gpu/drm/bridge/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c
@@ -638,10 +638,22 @@  static void anx78xx_poweron(struct anx78xx *anx78xx)
 	gpiod_set_value_cansleep(pdata->gpiod_reset, 0);
 
 	/* Power on registers module */
-	anx78xx_set_bits(anx78xx->map[I2C_IDX_TX_P2], SP_POWERDOWN_CTRL_REG,
-			 SP_HDCP_PD | SP_AUDIO_PD | SP_VIDEO_PD | SP_LINK_PD);
-	anx78xx_clear_bits(anx78xx->map[I2C_IDX_TX_P2], SP_POWERDOWN_CTRL_REG,
-			   SP_REGISTER_PD | SP_TOTAL_PD);
+	err = anx78xx_set_bits(anx78xx->map[I2C_IDX_TX_P2],
+			SP_POWERDOWN_CTRL_REG,
+			SP_HDCP_PD | SP_AUDIO_PD | SP_VIDEO_PD | SP_LINK_PD);
+	if (err) {
+		DRM_ERROR("Failed to set register bits: %d\n",
+				err);
+		return;
+	}
+	err = anx78xx_clear_bits(anx78xx->map[I2C_IDX_TX_P2],
+			SP_POWERDOWN_CTRL_REG,
+			SP_REGISTER_PD | SP_TOTAL_PD);
+	if (err) {
+		DRM_ERROR("Failed to clear register bits: %d\n",
+				err);
+		return;
+	}
 
 	anx78xx->powered = true;
 }