Skip to content

Commit

Permalink
net: dsa: don't stop at NOTIFY_OK when calling ds->ops->port_prechang…
Browse files Browse the repository at this point in the history
…eupper

dsa_slave_prechangeupper_sanity_check() is supposed to enforce some
adjacency restrictions, and calls ds->ops->port_prechangeupper if the
driver implements it.

We convert the error code from the port_prechangeupper() call to a
notifier code, and 0 is converted to NOTIFY_OK, but the caller of
dsa_slave_prechangeupper_sanity_check() stops at any notifier code
different from NOTIFY_DONE.

Avoid this by converting back the notifier code to an error code, so
that both NOTIFY_OK and NOTIFY_DONE will be seen as 0. This allows more
parallel sanity check functions to be added.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Vladimir Oltean authored and Paolo Abeni committed Aug 23, 2022
1 parent 4c3f80d commit 0498277
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -2710,7 +2710,7 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb,
int err;

err = dsa_slave_prechangeupper_sanity_check(dev, info);
if (err != NOTIFY_DONE)
if (notifier_to_errno(err))
return err;

err = dsa_slave_prechangeupper(dev, ptr);
Expand Down

0 comments on commit 0498277

Please sign in to comment.