From a8e63fa964480663518da8ddcf34c1430ff73416 Mon Sep 17 00:00:00 2001 From: Konstantin Makariev Date: Tue, 14 Sep 2021 13:50:55 -0500 Subject: [PATCH] pct1812_mmi: properly fail probe on i2c error When I2C bus is unavailable, waiting for ready state will fail due to I2C error and not just time out. In that case probe shall fail gracefully and exit immediately. Change-Id: Ida7e1877de0893d2d0e0941dbc3ef082ef7ba36f Signed-off-by: Konstantin Makariev Reviewed-on: https://gerrit.mot.com/2066631 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ling Jin Submit-Approved: Jira Key --- drivers/input/touchscreen/pixart_mmi/pct1812_captouch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/pixart_mmi/pct1812_captouch.c b/drivers/input/touchscreen/pixart_mmi/pct1812_captouch.c index d4699042e8ae..141bc85f0418 100644 --- a/drivers/input/touchscreen/pixart_mmi/pct1812_captouch.c +++ b/drivers/input/touchscreen/pixart_mmi/pct1812_captouch.c @@ -1504,8 +1504,8 @@ failure: pct1812_set_bank(ts, BANK(6)); ret = pct1812_wait4ready(ts, BOOT_STATUS_REG, BOOT_COMPLETE); - if (ret == -ETIME) { - dev_err(ts->dev, "%s: Init timed out\n", __func__); + if (ret) { + dev_err(ts->dev, "%s: Failed to init\n", __func__); } mutex_unlock(&ts->cmdlock); //__pm_relax(&ts->wake_src); @@ -2033,7 +2033,7 @@ static int pct1812_probe(struct i2c_client *client, const struct i2c_device_id * pct1812_delay_ms(TOUCH_RESET_DELAY); ret = pct1812_wait4ready(ts, BOOT_STATUS_REG, BOOT_COMPLETE); - if (ret == -ETIME) { + if (ret) { dev_err(&client->dev, "%s: Failed to init\n", __func__); goto error_init; }