From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Phong LE <ple@baylibre.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Javier Martinez Canillas <javierm@redhat.com>,
Julien Chauveau <chauveau.julien@gmail.com>
Cc: Paul Cercueil <paul.cercueil@bootlin.com>,
Nishanth Menon <nm@ti.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Luca Ceresoli <luca.ceresoli@bootlin.com>
Subject: [PATCH v2 1/4] drm/bridge: ite-it66121: check for read errors reading IDs
Date: Fri, 27 Nov 2026 12:20:36 +0100 [thread overview]
Message-ID: <20261127-drm-ite-it66121-log-probe-errors-v2-1-dbe9b5a3c5df@bootlin.com> (raw)
In-Reply-To: <20261127-drm-ite-it66121-log-probe-errors-v2-0-dbe9b5a3c5df@bootlin.com>
it66121_probe() calls regmap_read() four times to read the vendor and
device ID registers, without error checking. This leads to silently
continuing using invalid ID values when any of the reads fail (which has
happened and is being fixed [0]).
Adding error checking on all 4 regmap_read()s would be annoying, so switch
to regmap_bulk_read().
[0] https://lore.kernel.org/lkml/20261105-drm-ite-it66121-fix-reset-v2-1-02039d66af29@bootlin.com/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- Use just a u8 array (Javier)
- Split v1 patch 1 in two parts (Javier)
---
drivers/gpu/drm/bridge/ite-it66121.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 34302db25a8e..8bc96ef006f8 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1572,7 +1572,8 @@ static const struct it66121_chip_info it66xx_chip_info[] = {
static int it66121_probe(struct i2c_client *client)
{
- u32 revision_id, vendor_ids[2] = { 0 }, device_ids[2] = { 0 };
+ __u8 chip_id_regs[4];
+ u32 revision_id;
struct device_node *ep;
int ret, i;
struct it66121_ctx *ctx;
@@ -1636,19 +1637,19 @@ static int it66121_probe(struct i2c_client *client)
if (IS_ERR(ctx->regmap))
return PTR_ERR(ctx->regmap);
- regmap_read(ctx->regmap, IT66121_VENDOR_ID0_REG, &vendor_ids[0]);
- regmap_read(ctx->regmap, IT66121_VENDOR_ID1_REG, &vendor_ids[1]);
- regmap_read(ctx->regmap, IT66121_DEVICE_ID0_REG, &device_ids[0]);
- regmap_read(ctx->regmap, IT66121_DEVICE_ID1_REG, &device_ids[1]);
+ ret = regmap_bulk_read(ctx->regmap, IT66121_VENDOR_ID0_REG,
+ &chip_id_regs, sizeof(chip_id_regs));
+ if (ret)
+ return dev_err_probe(dev, ret, "Error reading device IDs\n");
/* Revision is shared with DEVICE_ID1 */
- revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]);
- device_ids[1] &= IT66121_DEVICE_ID1_MASK;
+ revision_id = FIELD_GET(IT66121_REVISION_MASK, chip_id_regs[3]);
+ chip_id_regs[3] &= IT66121_DEVICE_ID1_MASK;
for (i = 0; i < ARRAY_SIZE(it66xx_chip_info); i++) {
chip_info = &it66xx_chip_info[i];
- if ((vendor_ids[1] << 8 | vendor_ids[0]) == chip_info->vid &&
- (device_ids[1] << 8 | device_ids[0]) == chip_info->pid) {
+ if ((chip_id_regs[1] << 8 | chip_id_regs[0]) == chip_info->vid &&
+ (chip_id_regs[3] << 8 | chip_id_regs[2]) == chip_info->pid) {
ctx->id = chip_info->id;
break;
}
--
2.56.1
next prev parent reply other threads:[~2026-11-27 11:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 11:20 [PATCH v2 0/4] drm/bridge: ite-it66121: use bulk read, improve probe logging Luca Ceresoli
2026-11-27 11:20 ` Luca Ceresoli [this message]
2026-11-27 11:20 ` [PATCH v2 2/4] drm/bridge: ite-it66121: simplify getting the chip IDs Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 3/4] drm/bridge: ite-it66121: log an error if the IDs do not match Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 4/4] drm/bridge: ite-it66121: make successful probe quiet Luca Ceresoli
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=20261127-drm-ite-it66121-log-probe-errors-v2-1-dbe9b5a3c5df@bootlin.com \
--to=luca.ceresoli@bootlin.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=chauveau.julien@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nm@ti.com \
--cc=paul.cercueil@bootlin.com \
--cc=ple@baylibre.com \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=thomas.petazzoni@bootlin.com \
--cc=tzimmermann@suse.de \
/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®