net: switchdev: don't abort unsupported operations

There is no need to abort attribute setting or object addition, if the
prepare phase returned operation not supported.

Thus, abort these two transactions only if the error is not -EOPNOTSUPP.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vivien Didelot 2015-07-10 19:48:58 -04:00 committed by David S. Miller
parent c590032f9a
commit 2ee94014d9

View File

@ -171,8 +171,10 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr)
* released. * released.
*/ */
attr->trans = SWITCHDEV_TRANS_ABORT; if (err != -EOPNOTSUPP) {
__switchdev_port_attr_set(dev, attr); attr->trans = SWITCHDEV_TRANS_ABORT;
__switchdev_port_attr_set(dev, attr);
}
return err; return err;
} }
@ -249,8 +251,10 @@ int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj)
* released. * released.
*/ */
obj->trans = SWITCHDEV_TRANS_ABORT; if (err != -EOPNOTSUPP) {
__switchdev_port_obj_add(dev, obj); obj->trans = SWITCHDEV_TRANS_ABORT;
__switchdev_port_obj_add(dev, obj);
}
return err; return err;
} }