Skip to content

Commit

Permalink
V4L/DVB (6466): v4l2-i2c-drv: first call remove, then detach client
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 25, 2008
1 parent 188f345 commit a2e521e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/media/v4l2-i2c-drv-legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter)

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;
Expand Down

0 comments on commit a2e521e

Please sign in to comment.