tc = netdev_txq_to_tc(dev, index);
if (tc < 0) {
- ret = -EINVAL;
- goto err_rtnl_unlock;
+ rtnl_unlock();
+ return -EINVAL;
}
+ /* Make sure the subordinate device can't be freed */
+ get_device(&dev->dev);
+ rtnl_unlock();
+
rcu_read_lock();
dev_maps = rcu_dereference(dev->xps_maps[XPS_CPUS]);
nr_ids = dev_maps ? dev_maps->nr_ids : nr_cpu_ids;
}
out_no_maps:
rcu_read_unlock();
-
- rtnl_unlock();
+ put_device(&dev->dev);
len = bitmap_print_to_pagebuf(false, buf, mask, nr_ids);
bitmap_free(mask);
err_rcu_unlock:
rcu_read_unlock();
-err_rtnl_unlock:
- rtnl_unlock();
+ put_device(&dev->dev);
return ret;
}
return restart_syscall();
tc = netdev_txq_to_tc(dev, index);
- if (tc < 0) {
- ret = -EINVAL;
- goto err_rtnl_unlock;
- }
+ rtnl_unlock();
+ if (tc < 0)
+ return -EINVAL;
rcu_read_lock();
dev_maps = rcu_dereference(dev->xps_maps[XPS_RXQS]);
out_no_maps:
rcu_read_unlock();
- rtnl_unlock();
-
len = bitmap_print_to_pagebuf(false, buf, mask, nr_ids);
bitmap_free(mask);
err_rcu_unlock:
rcu_read_unlock();
-err_rtnl_unlock:
- rtnl_unlock();
return ret;
}