[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190321132019.1426-11-jiri@resnulli.us>
Date: Thu, 21 Mar 2019 14:20:18 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, mlxsw@...lanox.com, idosch@...lanox.com,
jakub.kicinski@...ronome.com, f.fainelli@...il.com, andrew@...n.ch,
vivien.didelot@...il.com
Subject: [patch net-next 10/11] net: devlink: disallow port_attrs_set() to be called before register
From: Jiri Pirko <jiri@...lanox.com>
Since the port attributes are static and cannot change during the port
lifetime, WARN_ON if some driver calls it after registration. Also, no
need to call notifications as it is noop anyway due to check of
devlink_port->registered there.
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
net/core/devlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 98ca788ffd97..f77a68f72d14 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -5425,12 +5425,13 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port,
{
struct devlink_port_attrs *attrs = &devlink_port->attrs;
+ if (WARN_ON(devlink_port->registered))
+ return;
attrs->set = true;
attrs->flavour = flavour;
attrs->port_number = port_number;
attrs->split = split;
attrs->split_subport_number = split_subport_number;
- devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
}
EXPORT_SYMBOL_GPL(devlink_port_attrs_set);
--
2.17.2
Powered by blists - more mailing lists