[PATCH v3 1/3] usb: typec: tipd: add error message for vendor ID read failure
From: Radhey Shyam Pandey
Date: Thu Jun 18 2026 - 03:49:51 EST
Log an error when the vendor ID read fails or returns zero, including
the I2C error code and register value, and initialize the vendor ID
variable to avoid logging an uninitialized value on read failure.
Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xxxxxxx>
---
Changes for v3:
- Add Heikki reviewed-by tag.
Changes for v2:
- Extend commit description to justify vid initialization.
---
drivers/usb/typec/tipd/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index d5ee0af9058b..465788f8490a 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -1744,7 +1744,7 @@ static int tps6598x_probe(struct i2c_client *client)
struct tps6598x *tps;
struct fwnode_handle *fwnode;
u32 status;
- u32 vid;
+ u32 vid = 0;
int ret;
data = i2c_get_match_data(client);
@@ -1772,8 +1772,11 @@ static int tps6598x_probe(struct i2c_client *client)
if (!device_is_compatible(tps->dev, "ti,tps25750")) {
ret = tps6598x_read32(tps, TPS_REG_VID, &vid);
- if (ret < 0 || !vid)
+ if (ret < 0 || !vid) {
+ dev_err(tps->dev, "failed to read vendor ID: %d, vid: %#x\n",
+ ret, vid);
return -ENODEV;
+ }
}
/*
--
2.43.0