Commit 95133210 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller

net: stmmac: selftests: Return proper error code to userspace

We can do better than just return 1 to userspace. Lets return a proper
Linux error code.
Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44c40910
...@@ -318,7 +318,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv, ...@@ -318,7 +318,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv,
attr->timeout = STMMAC_LB_TIMEOUT; attr->timeout = STMMAC_LB_TIMEOUT;
wait_for_completion_timeout(&tpriv->comp, attr->timeout); wait_for_completion_timeout(&tpriv->comp, attr->timeout);
ret = !tpriv->ok; ret = tpriv->ok ? 0 : -ETIMEDOUT;
cleanup: cleanup:
if (!attr->dont_wait) if (!attr->dont_wait)
...@@ -480,7 +480,7 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv) ...@@ -480,7 +480,7 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv)
/* Shall NOT receive packet */ /* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr); ret = __stmmac_test_loopback(priv, &attr);
ret = !ret; ret = ret ? 0 : -EINVAL;
cleanup: cleanup:
dev_mc_del(priv->dev, gd_addr); dev_mc_del(priv->dev, gd_addr);
...@@ -512,7 +512,7 @@ static int stmmac_test_pfilt(struct stmmac_priv *priv) ...@@ -512,7 +512,7 @@ static int stmmac_test_pfilt(struct stmmac_priv *priv)
/* Shall NOT receive packet */ /* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr); ret = __stmmac_test_loopback(priv, &attr);
ret = !ret; ret = ret ? 0 : -EINVAL;
cleanup: cleanup:
dev_uc_del(priv->dev, gd_addr); dev_uc_del(priv->dev, gd_addr);
...@@ -562,7 +562,7 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv) ...@@ -562,7 +562,7 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv)
/* Shall NOT receive packet */ /* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr); ret = __stmmac_test_loopback(priv, &attr);
ret = !ret; ret = ret ? 0 : -EINVAL;
cleanup: cleanup:
dev_uc_del(priv->dev, uc_addr); dev_uc_del(priv->dev, uc_addr);
...@@ -600,7 +600,7 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv) ...@@ -600,7 +600,7 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv)
/* Shall NOT receive packet */ /* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr); ret = __stmmac_test_loopback(priv, &attr);
ret = !ret; ret = ret ? 0 : -EINVAL;
cleanup: cleanup:
dev_mc_del(priv->dev, mc_addr); dev_mc_del(priv->dev, mc_addr);
...@@ -699,7 +699,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv) ...@@ -699,7 +699,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)
} }
wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT); wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT);
ret = !tpriv->ok; ret = tpriv->ok ? 0 : -ETIMEDOUT;
cleanup: cleanup:
dev_mc_del(priv->dev, paddr); dev_mc_del(priv->dev, paddr);
...@@ -833,11 +833,11 @@ static int stmmac_test_vlanfilt(struct stmmac_priv *priv) ...@@ -833,11 +833,11 @@ static int stmmac_test_vlanfilt(struct stmmac_priv *priv)
goto vlan_del; goto vlan_del;
wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT); wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT);
ret = !tpriv->ok; ret = tpriv->ok ? 0 : -ETIMEDOUT;
if (ret && !i) { if (ret && !i) {
goto vlan_del; goto vlan_del;
} else if (!ret && i) { } else if (!ret && i) {
ret = -1; ret = -EINVAL;
goto vlan_del; goto vlan_del;
} else { } else {
ret = 0; ret = 0;
...@@ -909,11 +909,11 @@ static int stmmac_test_dvlanfilt(struct stmmac_priv *priv) ...@@ -909,11 +909,11 @@ static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)
goto vlan_del; goto vlan_del;
wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT); wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT);
ret = !tpriv->ok; ret = tpriv->ok ? 0 : -ETIMEDOUT;
if (ret && !i) { if (ret && !i) {
goto vlan_del; goto vlan_del;
} else if (!ret && i) { } else if (!ret && i) {
ret = -1; ret = -EINVAL;
goto vlan_del; goto vlan_del;
} else { } else {
ret = 0; ret = 0;
...@@ -998,7 +998,7 @@ static int stmmac_test_rxp(struct stmmac_priv *priv) ...@@ -998,7 +998,7 @@ static int stmmac_test_rxp(struct stmmac_priv *priv)
attr.src = addr; attr.src = addr;
ret = __stmmac_test_loopback(priv, &attr); ret = __stmmac_test_loopback(priv, &attr);
ret = !ret; /* Shall NOT receive packet */ ret = ret ? 0 : -EINVAL; /* Shall NOT receive packet */
cls_u32.command = TC_CLSU32_DELETE_KNODE; cls_u32.command = TC_CLSU32_DELETE_KNODE;
stmmac_tc_setup_cls_u32(priv, priv, &cls_u32); stmmac_tc_setup_cls_u32(priv, priv, &cls_u32);
......
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