Message ID | 20190507084018.32009-1-m.felsch@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | input: qt1050: fix error check during identify the chip | expand |
Hi Marco, On Tue, May 07, 2019 at 10:40:18AM +0200, Marco Felsch wrote: > 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@pengutronix.de> > --- > 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. I ended up squashing the fix into the original change, thank you.
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; }
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@pengutronix.de> --- 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(-)