diff mbox

[1/7,media] adv7180: Fix remove order

Message ID 1394208873-23260-1-git-send-email-lars@metafoo.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lars-Peter Clausen March 7, 2014, 4:14 p.m. UTC
The mutex is used in the subdev callbacks, so unregister the subdev before the
mutex is destroyed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/media/i2c/adv7180.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index d7d99f1..1a3622a 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -616,8 +616,8 @@  static int adv7180_probe(struct i2c_client *client,
 err_free_ctrl:
 	adv7180_exit_controls(state);
 err_unreg_subdev:
-	mutex_destroy(&state->mutex);
 	v4l2_device_unregister_subdev(sd);
+	mutex_destroy(&state->mutex);
 err:
 	printk(KERN_ERR KBUILD_MODNAME ": Failed to probe: %d\n", ret);
 	return ret;
@@ -640,8 +640,8 @@  static int adv7180_remove(struct i2c_client *client)
 		}
 	}
 
-	mutex_destroy(&state->mutex);
 	v4l2_device_unregister_subdev(sd);
+	mutex_destroy(&state->mutex);
 	return 0;
 }