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