]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: dsa: sja1105: propagate exact error code from sja1105_dynamic_config_poll_valid()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 8 Sep 2023 13:33:49 +0000 (16:33 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Sep 2023 07:32:30 +0000 (08:32 +0100)
Currently, sja1105_dynamic_config_wait_complete() returns either 0 or
-ETIMEDOUT, because it just looks at the read_poll_timeout() return code.

There will be future changes which move some more checks to
sja1105_dynamic_config_poll_valid(). It is important that we propagate
their exact return code (-ENOENT, -EINVAL), because callers of
sja1105_dynamic_config_read() depend on them.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_dynamic_config.c

index 7729d3f8b7f50a1a8fd85f1b5f34381817228812..93d47dab8d3e9a56e05aa5411a3750cbffdaa8fc 100644 (file)
@@ -1211,13 +1211,14 @@ sja1105_dynamic_config_wait_complete(struct sja1105_private *priv,
                                     struct sja1105_dyn_cmd *cmd,
                                     const struct sja1105_dynamic_table_ops *ops)
 {
-       int rc;
-
-       return read_poll_timeout(sja1105_dynamic_config_poll_valid,
-                                rc, rc != -EAGAIN,
-                                SJA1105_DYNAMIC_CONFIG_SLEEP_US,
-                                SJA1105_DYNAMIC_CONFIG_TIMEOUT_US,
-                                false, priv, cmd, ops);
+       int err, rc;
+
+       err = read_poll_timeout(sja1105_dynamic_config_poll_valid,
+                               rc, rc != -EAGAIN,
+                               SJA1105_DYNAMIC_CONFIG_SLEEP_US,
+                               SJA1105_DYNAMIC_CONFIG_TIMEOUT_US,
+                               false, priv, cmd, ops);
+       return err < 0 ? err : rc;
 }
 
 /* Provides read access to the settings through the dynamic interface