aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
index 433c984eefa..241854229d6 100644
--- a/include/media/v4l2-i2c-drv-legacy.h
+++ b/include/media/v4l2-i2c-drv-legacy.h
@@ -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;