net/axgbe: fix unreleased lock in I2C transfer

The lock pdata->i2c_mutex is not released if the function return in
these two patched branches, which may lead to deadlock problem if
this lock is acquired again.

Bugzilla ID: 777
Fixes: 4ac7516b8b ("net/axgbe: add phy init and related APIs")
Cc: stable@dpdk.org

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Chengfeng Ye 2021-08-26 11:55:59 -07:00 committed by Ferruh Yigit
parent c4498cb315
commit 30b4d95a29

View File

@ -233,6 +233,7 @@ static int axgbe_i2c_xfer(struct axgbe_port *pdata, struct axgbe_i2c_op *op)
ret = axgbe_i2c_disable(pdata);
if (ret) {
PMD_DRV_LOG(ERR, "failed to disable i2c master\n");
pthread_mutex_unlock(&pdata->i2c_mutex);
return ret;
}
@ -249,6 +250,7 @@ static int axgbe_i2c_xfer(struct axgbe_port *pdata, struct axgbe_i2c_op *op)
ret = axgbe_i2c_enable(pdata);
if (ret) {
PMD_DRV_LOG(ERR, "failed to enable i2c master\n");
pthread_mutex_unlock(&pdata->i2c_mutex);
return ret;
}