Commit 24751e29 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: mv88e6xxx: call _mv88e6xxx_stats_wait with SMI lock held

At switch setup, _mv88e6xxx_stats_wait was called without holding the
SMI mutex. Fix this by requesting the lock for this call.

Also, return the _mv88e6xxx_stats_wait code, since it may fail.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e44deb2f
...@@ -1881,6 +1881,7 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds) ...@@ -1881,6 +1881,7 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds)
int mv88e6xxx_setup_global(struct dsa_switch *ds) int mv88e6xxx_setup_global(struct dsa_switch *ds)
{ {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
int ret;
int i; int i;
/* Set the default address aging time to 5 minutes, and /* Set the default address aging time to 5 minutes, and
...@@ -1979,9 +1980,11 @@ int mv88e6xxx_setup_global(struct dsa_switch *ds) ...@@ -1979,9 +1980,11 @@ int mv88e6xxx_setup_global(struct dsa_switch *ds)
REG_WRITE(REG_GLOBAL, GLOBAL_STATS_OP, GLOBAL_STATS_OP_FLUSH_ALL); REG_WRITE(REG_GLOBAL, GLOBAL_STATS_OP, GLOBAL_STATS_OP_FLUSH_ALL);
/* Wait for the flush to complete. */ /* Wait for the flush to complete. */
_mv88e6xxx_stats_wait(ds); mutex_lock(&ps->smi_mutex);
ret = _mv88e6xxx_stats_wait(ds);
mutex_unlock(&ps->smi_mutex);
return 0; return ret;
} }
int mv88e6xxx_switch_reset(struct dsa_switch *ds, bool ppu_active) int mv88e6xxx_switch_reset(struct dsa_switch *ds, bool ppu_active)
......
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