Re: [PATCH v6 07/10] i2c: cgbc: Add support for fixed frequency buses
From: Andi Shyti
Date: Thu Nov 26 2026 - 12:39:44 EST
Hi Thomas,
...
> +static int cgbc_i2c_get_frequency(struct i2c_adapter *adap)
> +{
> + struct cgbc_i2c_data *i2c = i2c_get_adapdata(adap);
> + struct cgbc_device_data *cgbc = i2c->cgbc;
> + u8 cmd[2] = { CGBC_I2C_CMD_SPEED | i2c->bus_id };
> + unsigned int bus_frequency;
> + u8 data;
as we are here we can fix a pre-existing small bug, by
initializing data to '0' and...
> + int ret;
>
> ret = cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL);
> if (ret)
... returning error (e.g. EIO) when !data. We avoid a potential
division by '0' (a comment would help, as well).
Andi
> - return dev_err_probe(i2c->dev, ret,
> - "Failed to get I2C bus frequency");
> + return ret;
>