Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6edf1017 authored by Elad Raz's avatar Elad Raz Committed by David S. Miller
Browse files

devlink: Prevent port_type_set() callback when it's not needed



When a port_type_set() is been called and the new port type set is the same
as the old one, just return success.

Signed-off-by: default avatarElad Raz <eladr@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89ab88b0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -608,6 +608,8 @@ static int devlink_port_type_set(struct devlink *devlink,
	if (devlink->ops && devlink->ops->port_type_set) {
		if (port_type == DEVLINK_PORT_TYPE_NOTSET)
			return -EINVAL;
		if (port_type == devlink_port->type)
			return 0;
		err = devlink->ops->port_type_set(devlink_port, port_type);
		if (err)
			return err;