[PATCH] input: qt1050: fix error check during identify the chip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The regmap_read return value must be checked decide if the read was
successful or not and not the read value.

Fixes: a33ff45923c8 ("Input: qt1050 - add Microchip AT42QT1050 support")
Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
Hi Dmitry,

there was a issue which was covered by Colin Ian King. Can you add this
fix please? Maybe you can squash the fix.

Regards,
  Marco

 drivers/input/keyboard/qt1050.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c
index 2a816efdedbc..749016fc1ca7 100644
--- a/drivers/input/keyboard/qt1050.c
+++ b/drivers/input/keyboard/qt1050.c
@@ -223,6 +223,7 @@ static struct regmap_config qt1050_regmap_config = {
 static bool qt1050_identify(struct qt1050_priv *ts)
 {
 	unsigned int val;
+	int err;
 
 	/* Read Chip ID */
 	regmap_read(ts->regmap, QT1050_CHIP_ID, &val);
@@ -232,8 +233,8 @@ static bool qt1050_identify(struct qt1050_priv *ts)
 	}
 
 	/* Read firmware version */
-	regmap_read(ts->regmap, QT1050_FW_VERSION, &val);
-	if (val < 0) {
+	err = regmap_read(ts->regmap, QT1050_FW_VERSION, &val);
+	if (err) {
 		dev_err(&ts->client->dev, "could not read the firmware version\n");
 		return false;
 	}
-- 
2.20.1




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux