The remove driver function expects that the client is still attached
to the driver, so do the detach after calling remove().
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client)
{
- int err = i2c_detach_client(client);
+ int err;
- if (err)
- return err;
if (v4l2_i2c_data.remove)
v4l2_i2c_data.remove(client);
+
+ err = i2c_detach_client(client);
+ if (err)
+ return err;
kfree(client);
return 0;