Commit c6f854d5 authored by Veaceslav Falico's avatar Veaceslav Falico Committed by David S. Miller
Browse files

net: use dev->name in netdev_pr* when it's available

netdev_name() returns dev->name only when the net_device is in

However, dev->name is always populated on creation, so we can easily use

There are two cases when there's no real name - when it's an empty string
or when the name is in form of "eth%d", then netdev_name() returns "unnamed

CC: "David S. Miller" <>
CC: Tom Gundersen <>
Signed-off-by: default avatarVeaceslav Falico <>
Acked-by: default avatarTom Gundersen <>
Signed-off-by: default avatarDavid S. Miller <>
parent 3e403a77
......@@ -3383,8 +3383,8 @@ extern struct pernet_operations __net_initdata loopback_net_ops;
static inline const char *netdev_name(const struct net_device *dev)
if (dev->reg_state != NETREG_REGISTERED)
return "(unregistered net_device)";
if (!dev->name[0] || strchr(dev->name, '%'))
return "(unnamed net_device)";
return dev->name;
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