1 From 0d56e5c191b197e1d30a0a4c92628836dafced0f Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <weiyongjun1@huawei.com>
3 Date: Tue, 18 May 2021 11:24:13 +0000
4 Subject: [PATCH] net: dsa: qca8k: fix missing unlock on error in
7 Add the missing unlock before return from function qca8k_vlan_add()
8 and qca8k_vlan_del() in the error handling case.
10 Fixes: 028f5f8ef44f ("net: dsa: qca8k: handle error with qca8k_read operation")
11 Reported-by: Hulk Robot <hulkci@huawei.com>
12 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
13 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
16 drivers/net/dsa/qca8k.c | 16 ++++++++++------
17 1 file changed, 10 insertions(+), 6 deletions(-)
19 --- a/drivers/net/dsa/qca8k.c
20 +++ b/drivers/net/dsa/qca8k.c
21 @@ -506,8 +506,10 @@ qca8k_vlan_add(struct qca8k_priv *priv,
24 reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0);
31 reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN;
32 reg &= ~(QCA8K_VTU_FUNC0_EG_MODE_MASK << QCA8K_VTU_FUNC0_EG_MODE_S(port));
34 @@ -519,7 +521,7 @@ qca8k_vlan_add(struct qca8k_priv *priv,
36 ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg);
40 ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid);
43 @@ -541,8 +543,10 @@ qca8k_vlan_del(struct qca8k_priv *priv,
46 reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0);
53 reg &= ~(3 << QCA8K_VTU_FUNC0_EG_MODE_S(port));
54 reg |= QCA8K_VTU_FUNC0_EG_MODE_NOT <<
55 QCA8K_VTU_FUNC0_EG_MODE_S(port);
56 @@ -564,7 +568,7 @@ qca8k_vlan_del(struct qca8k_priv *priv,
58 ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg);
62 ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid);