Re: [PATCH v2 1/3] usb: typec: tipd: add error message for vendor ID read failure
From: Heikki Krogerus
Date: Mon Jun 01 2026 - 09:41:26 EST
On Tue, May 19, 2026 at 11:49:54PM +0530, Radhey Shyam Pandey wrote:
> 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.
>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xxxxxxx>
Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> ---
> 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 43faec794b95..b282366b5326 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
--
heikki