360ce1d9473cd521d1fbf0aed0ee9e3c78a3dc4d
[openwrt/staging/neocturne.git] /
1 From b7c818d194927bdc60ed15db55bb8654496a36b7 Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Fri, 14 May 2021 22:59:58 +0200
4 Subject: [PATCH] net: dsa: qca8k: handle error from qca8k_busy_wait
5
6 Propagate errors from qca8k_busy_wait instead of hardcoding return
7 value.
8
9 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
10 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
12 ---
13 drivers/net/dsa/qca8k.c | 21 +++++++++++++--------
14 1 file changed, 13 insertions(+), 8 deletions(-)
15
16 --- a/drivers/net/dsa/qca8k.c
17 +++ b/drivers/net/dsa/qca8k.c
18 @@ -388,8 +388,9 @@ qca8k_fdb_access(struct qca8k_priv *priv
19 return ret;
20
21 /* wait for completion */
22 - if (qca8k_busy_wait(priv, QCA8K_REG_ATU_FUNC, QCA8K_ATU_FUNC_BUSY))
23 - return -1;
24 + ret = qca8k_busy_wait(priv, QCA8K_REG_ATU_FUNC, QCA8K_ATU_FUNC_BUSY);
25 + if (ret)
26 + return ret;
27
28 /* Check for table full violation when adding an entry */
29 if (cmd == QCA8K_FDB_LOAD) {
30 @@ -468,8 +469,9 @@ qca8k_vlan_access(struct qca8k_priv *pri
31 return ret;
32
33 /* wait for completion */
34 - if (qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY))
35 - return -ETIMEDOUT;
36 + ret = qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY);
37 + if (ret)
38 + return ret;
39
40 /* Check for table full violation when adding an entry */
41 if (cmd == QCA8K_VLAN_LOAD) {
42 @@ -580,7 +582,9 @@ qca8k_mib_init(struct qca8k_priv *priv)
43 if (ret)
44 goto exit;
45
46 - qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY);
47 + ret = qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY);
48 + if (ret)
49 + goto exit;
50
51 ret = qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_CPU_KEEP);
52 if (ret)
53 @@ -670,9 +674,10 @@ qca8k_mdio_read(struct qca8k_priv *priv,
54 if (ret)
55 return ret;
56
57 - if (qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL,
58 - QCA8K_MDIO_MASTER_BUSY))
59 - return -ETIMEDOUT;
60 + ret = qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL,
61 + QCA8K_MDIO_MASTER_BUSY);
62 + if (ret)
63 + return ret;
64
65 val = qca8k_read(priv, QCA8K_MDIO_MASTER_CTRL);
66 if (val < 0)