Commit 2b239e70 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

net: devlink: warn on setting type on unregistered port

Port needs to be registered first before the type is set. Warn and
bail-out in case it is not.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d0d54e8c
......@@ -5328,6 +5328,8 @@ static void __devlink_port_type_set(struct devlink_port *devlink_port,
enum devlink_port_type type,
void *type_dev)
{
if (WARN_ON(!devlink_port->registered))
return;
devlink_port->type = type;
devlink_port->type_dev = type_dev;
devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment