net/: Change order of logic: Select the user-defined interface name format BEFORE determining the minor device number. Otherwise, the devault interface name will be used.

This commit is contained in:
Gregory Nutt 2018-08-14 08:40:06 -06:00
parent 4a724b1f3c
commit b00a2e5c54
1 changed files with 15 additions and 15 deletions

View File

@ -362,21 +362,6 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
* the interface
*/
#ifdef CONFIG_NET_LOOPBACK
/* The local loopback device is a special case: There can be only one
* local loopback device so it is unnumbered.
*/
if (lltype == NET_LL_LOOPBACK)
{
devnum = 0;
}
else
#endif
{
devnum = find_devnum(devfmt);
}
/* Check if the caller has provided a user device-specific interface
* name format string (in d_ifname).
*/
@ -399,6 +384,21 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
devfmt = devfmt_str;
}
#ifdef CONFIG_NET_LOOPBACK
/* The local loopback device is a special case: There can be only one
* local loopback device so it is unnumbered.
*/
if (lltype == NET_LL_LOOPBACK)
{
devnum = 0;
}
else
#endif
{
devnum = find_devnum(devfmt);
}
/* Complete the device name by including the device number (if
* included in the format).
*/