Commit 0d56e5c1 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

net: dsa: qca8k: fix missing unlock on error in qca8k_vlan_(add|del)

Add the missing unlock before return from function qca8k_vlan_add()
and qca8k_vlan_del() in the error handling case.

Fixes: 028f5f8e ("net: dsa: qca8k: handle error with qca8k_read operation")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4ac9e23c
...@@ -506,8 +506,10 @@ qca8k_vlan_add(struct qca8k_priv *priv, u8 port, u16 vid, bool untagged) ...@@ -506,8 +506,10 @@ qca8k_vlan_add(struct qca8k_priv *priv, u8 port, u16 vid, bool untagged)
goto out; goto out;
reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0);
if (reg < 0) if (reg < 0) {
return reg; ret = reg;
goto out;
}
reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN; reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN;
reg &= ~(QCA8K_VTU_FUNC0_EG_MODE_MASK << QCA8K_VTU_FUNC0_EG_MODE_S(port)); reg &= ~(QCA8K_VTU_FUNC0_EG_MODE_MASK << QCA8K_VTU_FUNC0_EG_MODE_S(port));
if (untagged) if (untagged)
...@@ -519,7 +521,7 @@ qca8k_vlan_add(struct qca8k_priv *priv, u8 port, u16 vid, bool untagged) ...@@ -519,7 +521,7 @@ qca8k_vlan_add(struct qca8k_priv *priv, u8 port, u16 vid, bool untagged)
ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg);
if (ret) if (ret)
return ret; goto out;
ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid); ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid);
out: out:
...@@ -541,8 +543,10 @@ qca8k_vlan_del(struct qca8k_priv *priv, u8 port, u16 vid) ...@@ -541,8 +543,10 @@ qca8k_vlan_del(struct qca8k_priv *priv, u8 port, u16 vid)
goto out; goto out;
reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0);
if (reg < 0) if (reg < 0) {
return reg; ret = reg;
goto out;
}
reg &= ~(3 << QCA8K_VTU_FUNC0_EG_MODE_S(port)); reg &= ~(3 << QCA8K_VTU_FUNC0_EG_MODE_S(port));
reg |= QCA8K_VTU_FUNC0_EG_MODE_NOT << reg |= QCA8K_VTU_FUNC0_EG_MODE_NOT <<
QCA8K_VTU_FUNC0_EG_MODE_S(port); QCA8K_VTU_FUNC0_EG_MODE_S(port);
...@@ -564,7 +568,7 @@ qca8k_vlan_del(struct qca8k_priv *priv, u8 port, u16 vid) ...@@ -564,7 +568,7 @@ qca8k_vlan_del(struct qca8k_priv *priv, u8 port, u16 vid)
} else { } else {
ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg);
if (ret) if (ret)
return ret; goto out;
ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid); ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment