diff mbox series

[-next] ptp: Fix missing unlock on error in idtcm_probe()

Message ID 20191106115308.112645-1-weiyongjun1@huawei.com
State Not Applicable
Delegated to: David Miller
Headers show
Series [-next] ptp: Fix missing unlock on error in idtcm_probe() | expand

Commit Message

Wei Yongjun Nov. 6, 2019, 11:53 a.m. UTC
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>
---
 drivers/ptp/ptp_clockmatrix.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Vincent Cheng Nov. 6, 2019, 2:02 p.m. UTC | #1
On Wed, Nov 06, 2019 at 06:53:08AM EST, Wei Yongjun wrote:
>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>
>---
> drivers/ptp/ptp_clockmatrix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
>index cf5889b7d825..a5110b7b4ece 100644
>--- a/drivers/ptp/ptp_clockmatrix.c
>+++ b/drivers/ptp/ptp_clockmatrix.c
>@@ -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);
>

Yes, good catch.  Thank-you for the fix.

Reviewed-by: Vincent Cheng  <vincent.cheng.xh@renesas.com>
Dan Carpenter Nov. 6, 2019, 2:25 p.m. UTC | #2
The prefix should probably be "ptp: ptp_clockmatrix: Fix missing ..." or
something.  This is a problem when we don't set a prefix when the driver
is first merged and then the first person to send a fix has to guess
what the maintainers are going to want to use.

The only other patch to this driver is commit 3a6ba7dc7799 ("ptp: Add a
ptp clock driver for IDT ClockMatrix.") so it's impossible to know.

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index cf5889b7d825..a5110b7b4ece 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -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);