Commit a2e521e85c04af3511af3ea8971efb4ef8bde533

Authored by Hans Verkuil
Committed by Mauro Carvalho Chehab
1 parent 188f3457c2

V4L/DVB (6466): v4l2-i2c-drv: first call remove, then detach client

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>

Showing 1 changed file with 5 additions and 3 deletions Side-by-side Diff

include/media/v4l2-i2c-drv-legacy.h
... ... @@ -58,12 +58,14 @@
58 58  
59 59 static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client)
60 60 {
61   - int err = i2c_detach_client(client);
  61 + int err;
62 62  
63   - if (err)
64   - return err;
65 63 if (v4l2_i2c_data.remove)
66 64 v4l2_i2c_data.remove(client);
  65 +
  66 + err = i2c_detach_client(client);
  67 + if (err)
  68 + return err;
67 69 kfree(client);
68 70  
69 71 return 0;