From: Andrei Lalaev <andrey.lalaev@gmail.com>
To: dmitry.torokhov@gmail.com, robh@kernel.org, m.felsch@pengutronix.de
Cc: andrey.lalaev@gmail.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org,
Andrei Lalaev <andrei.lalaev@anton-paar.com>
Subject: [PATCH] Input: qt1050 - handle CHIP_ID reading error
Date: Mon, 17 Jun 2024 20:30:18 +0200 [thread overview]
Message-ID: <20240617183018.916234-1-andrey.lalaev@gmail.com> (raw)
From: Andrei Lalaev <andrei.lalaev@anton-paar.com>
If the device is missing, we get the following error:
qt1050 3-0041: ID -1340767592 not supported
Let's handle this situation and print more informative error
when reading of CHIP_ID fails:
qt1050 3-0041: Failed to read chip ID: -6
Fixes: cbebf5addec1 ("Input: qt1050 - add Microchip AT42QT1050 support")
Signed-off-by: Andrei Lalaev <andrei.lalaev@anton-paar.com>
---
drivers/input/keyboard/qt1050.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c
index b51dfcd76038..056e9bc26026 100644
--- a/drivers/input/keyboard/qt1050.c
+++ b/drivers/input/keyboard/qt1050.c
@@ -226,7 +226,12 @@ static bool qt1050_identify(struct qt1050_priv *ts)
int err;
/* Read Chip ID */
- regmap_read(ts->regmap, QT1050_CHIP_ID, &val);
+ err = regmap_read(ts->regmap, QT1050_CHIP_ID, &val);
+ if (err) {
+ dev_err(&ts->client->dev, "Failed to read chip ID: %d\n", err);
+ return false;
+ }
+
if (val != QT1050_CHIP_ID_VER) {
dev_err(&ts->client->dev, "ID %d not supported\n", val);
return false;
--
2.35.2
next reply other threads:[~2024-06-17 18:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 18:30 Andrei Lalaev [this message]
2024-06-25 8:32 ` Marco Felsch
2024-06-25 16:14 ` Dmitry Torokhov
2024-06-25 19:35 ` Andrei Lalaev
2024-06-25 19:30 Andrei Lalaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240617183018.916234-1-andrey.lalaev@gmail.com \
--to=andrey.lalaev@gmail.com \
--cc=andrei.lalaev@anton-paar.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®