summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorElad Raz <eladr@mellanox.com>2016-10-23 18:43:05 +0300
committerDavid S. Miller <davem@davemloft.net>2016-10-27 00:30:32 +0300
commit6edf10173a1feb1078f2fc8c655baf9614e83493 (patch)
treeb8b023d22324234adc9827335650404d79995774 /net
parent89ab88b01bacc5bfc338693da3925504757e7844 (diff)
downloadlinux-6edf10173a1feb1078f2fc8c655baf9614e83493.tar.xz
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: Elad Raz <eladr@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/devlink.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 1b5063088f1a..d2fd736de6a2 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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;