Re: [PATCH] i2c: replace i2c_new_secondary_device with an ERR_PTR variant
From: Wolfram Sang
Date: Fri Aug 09 2019 - 11:41:07 EST
Hi Laurent,
> > > > + if (IS_ERR(state->i2c_clients[i])) {
> > > > + err = PTR_ERR(state->i2c_clients[i]);
> > > > v4l2_err(sd, "failed to create i2c client %u\n", i);
> > > > goto err_i2c;
>
> This will call adv76xx_unregister_clients(), which will try to
> i2c_unregister_device() all non-NULL i2c_clients entries. You need to
Uh, right! Sorry for missing this :(
> either set the entry to NULL here, or update
> adv76xx_unregister_clients() to skip IS_ERR() entries. My preference
> would be to store the return value of adv76xx_dummy_client() in a local
> variable here, and set state->i2c_clients[i] after the error check.
I implemented your preference and simplified
adv76xx_unregister_clients() because i2c_unregister_device is NULL
pointer aware. New patch coming in a minute.
Thanks for the review,
Wolfram
Attachment:
signature.asc
Description: PGP signature