Re: [PATCH v6 10/10] i2c: cgbc: Register known I2C devices on the bus
From: Andi Shyti
Date: Fri Nov 27 2026 - 05:34:45 EST
Hi Thomas,
On Thu, Nov 26, 2026 at 06:53:09PM +0100, Thomas Richard wrote:
> On 11/26/26 6:47 PM, Andi Shyti wrote:
> > Hi Thomas,
> >
> > ...
> >
> >> @@ -385,7 +385,15 @@ static int cgbc_i2c_probe(struct platform_device *pdev)
> >> if (ret)
> >> return dev_err_probe(i2c->dev, ret, "Failed to get I2C bus frequency");
> >>
> >> - return i2c_add_numbered_adapter(&i2c->adap);
> >> + ret = i2c_add_numbered_adapter(&i2c->adap);
> >> + if (ret)
> >> + return ret;
> >> +
> >> + /* Add known devices to the bus */
> >> + for (i = 0; i < pdata->nb_devices; i++)
> >> + i2c_new_client_device(&i2c->adap, pdata->devices + i);
> >
> > Please handle return values here.
> >
> Should the adapter probe return an error if we fail to add a new device
> to the bus?
yes, if we want to use it, we should exit probe with error if the
device instantiation fails.
Thanks,
Andi