From: "Lad, Prabhakar" <[email protected]>

Make sure to call mutex_destroy() in case of probe failure or module
unload.

Signed-off-by: Lad, Prabhakar <[email protected]>
---
 drivers/media/i2c/s5c73m3/s5c73m3-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c 
b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index ee0f57e..da0b3a3 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1658,7 +1658,6 @@ static int s5c73m3_probe(struct i2c_client *client,
        if (ret < 0)
                return ret;
 
-       mutex_init(&state->lock);
        sd = &state->sensor_sd;
        oif_sd = &state->oif_sd;
 
@@ -1695,6 +1694,8 @@ static int s5c73m3_probe(struct i2c_client *client,
        if (ret < 0)
                return ret;
 
+       mutex_init(&state->lock);
+
        ret = s5c73m3_configure_gpios(state);
        if (ret)
                goto out_err;
@@ -1754,6 +1755,7 @@ out_err1:
        s5c73m3_unregister_spi_driver(state);
 out_err:
        media_entity_cleanup(&sd->entity);
+       mutex_destroy(&state->lock);
        return ret;
 }
 
@@ -1772,6 +1774,7 @@ static int s5c73m3_remove(struct i2c_client *client)
        media_entity_cleanup(&sensor_sd->entity);
 
        s5c73m3_unregister_spi_driver(state);
+       mutex_destroy(&state->lock);
 
        return 0;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to