V4L/DVB (6466): v4l2-i2c-drv: first call remove, then detach client
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 17 Sep 2007 08:13:45 +0000 (05:13 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:01:28 +0000 (19:01 -0200)
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>
include/media/v4l2-i2c-drv-legacy.h

index 433c984eefa5fa3110ecf1607b3f3603a837b2a9..241854229d6f00a4eb82238de31a2987e4481a59 100644 (file)
@@ -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;