ptp: ptp_clockmatrix: Fix missing unlock on error in idtcm_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 6 Nov 2019 14:33:09 +0000 (14:33 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Nov 2019 05:19:59 +0000 (21:19 -0800)
Add the missing unlock before return from function idtcm_probe()
in the error handling case.

Fixes: 3a6ba7dc7799 ("ptp: Add a ptp clock driver for IDT ClockMatrix.")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_clockmatrix.c

index cf5889b..a5110b7 100644 (file)
@@ -1294,8 +1294,10 @@ static int idtcm_probe(struct i2c_client *client,
 
        err = set_tod_write_overhead(idtcm);
 
-       if (err)
+       if (err) {
+               mutex_unlock(&idtcm->reg_lock);
                return err;
+       }
 
        err = idtcm_load_firmware(idtcm, &client->dev);