{
struct devlink *devlink;
+ dev_hold(dev);
+ rtnl_unlock();
+
mutex_lock(&devlink_mutex);
devlink = netdev_to_devlink(dev);
if (!devlink || !devlink->ops || !devlink->ops->info_get)
mutex_unlock(&devlink->lock);
unlock_list:
mutex_unlock(&devlink_mutex);
+
+ rtnl_lock();
+ dev_put(dev);
}
int devlink_compat_flash_update(struct net_device *dev, const char *file_name)
struct devlink *devlink;
int ret = -EOPNOTSUPP;
+ dev_hold(dev);
+ rtnl_unlock();
+
mutex_lock(&devlink_mutex);
devlink = netdev_to_devlink(dev);
if (!devlink || !devlink->ops || !devlink->ops->flash_update)
mutex_unlock(&devlink->lock);
unlock_list:
mutex_unlock(&devlink_mutex);
+
+ rtnl_lock();
+ dev_put(dev);
+
return ret;
}
if (ops->get_eeprom_len)
info.eedump_len = ops->get_eeprom_len(dev);
- rtnl_unlock();
if (!info.fw_version[0])
devlink_compat_running_version(dev, info.fw_version,
sizeof(info.fw_version));
- rtnl_lock();
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return -EFAULT;
efl.data[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0;
- if (!dev->ethtool_ops->flash_device) {
- int ret;
-
- rtnl_unlock();
- ret = devlink_compat_flash_update(dev, efl.data);
- rtnl_lock();
-
- return ret;
- }
+ if (!dev->ethtool_ops->flash_device)
+ return devlink_compat_flash_update(dev, efl.data);
return dev->ethtool_ops->flash_device(dev, &efl);
}