From a348fc8147e20928b1858376769aa427850c018f Mon Sep 17 00:00:00 2001 From: Andrzej Hajda Date: Wed, 19 Oct 2016 13:42:05 +0200 Subject: [PATCH] drm/bridge/sii8620: add missing error checking The patch adds error checking during initialization and in irq handler. Change-Id: I26777455fb5ff86c91455a683b6cf5642fe2ed31 Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/bridge/sii8620.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii8620.c b/drivers/gpu/drm/bridge/sii8620.c index 9c2303f..f2b6cd5 100644 --- a/drivers/gpu/drm/bridge/sii8620.c +++ b/drivers/gpu/drm/bridge/sii8620.c @@ -1381,7 +1381,7 @@ static irqreturn_t sii8620_irq_thread(int irq, void *data) }; struct sii8620 *ctx = data; u8 stats[LEN_FAST_INTR_STAT]; - int i; + int i, ret; mutex_lock(&ctx->lock); @@ -1392,6 +1392,11 @@ static irqreturn_t sii8620_irq_thread(int irq, void *data) sii8620_mt_work(ctx); + ret = sii8620_clear_error(ctx); + if (ret) { + dev_err(ctx->dev, "Error during IRQ handling, %d.\n", ret); + sii8620_mhl_disconnected(ctx); + } mutex_unlock(&ctx->lock); return IRQ_HANDLED; @@ -1403,7 +1408,11 @@ static void sii8620_cable_in(struct sii8620 *ctx) u8 ver[5]; int ret; - sii8620_hw_on(ctx); + ret = sii8620_hw_on(ctx); + if (ret) { + dev_err(dev, "Error powering on, %d.\n", ret); + return; + } sii8620_hw_reset(ctx); msleep(100); @@ -1437,6 +1446,12 @@ static void sii8620_cable_in(struct sii8620 *ctx) REG_DPD, BIT_DPD_PWRON_PLL | BIT_DPD_PDNTX12 | BIT_DPD_OSC_EN, ); + ret = sii8620_clear_error(ctx); + if (ret) { + dev_err(dev, "Error accessing I2C bus, %d.\n", ret); + return; + } + enable_irq(to_i2c_client(ctx->dev)->irq); } -- 2.7.4