Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2e521e8 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 188f3457
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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;