diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-03-04 11:48:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-04 10:20:39 -0800 |
commit | 29ca1c5a4b4b4da8741f1a1204c3ab22f3cb1059 (patch) | |
tree | 30f490b5df0bb8bac0a89007ef1003ff3767ae33 | |
parent | 214fa1c43758bcc5f488bbe558c3e7dd325ac077 (diff) | |
download | linux-stable-29ca1c5a4b4b4da8741f1a1204c3ab22f3cb1059.tar.gz linux-stable-29ca1c5a4b4b4da8741f1a1204c3ab22f3cb1059.tar.bz2 linux-stable-29ca1c5a4b4b4da8741f1a1204c3ab22f3cb1059.zip |
net-sysfs: Switch to bitmap_zalloc()
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/net-sysfs.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 7c5061123ead..76161503527b 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1336,8 +1336,7 @@ static ssize_t xps_rxqs_show(struct netdev_queue *queue, char *buf) if (tc < 0) return -EINVAL; } - mask = kcalloc(BITS_TO_LONGS(dev->num_rx_queues), sizeof(long), - GFP_KERNEL); + mask = bitmap_zalloc(dev->num_rx_queues, GFP_KERNEL); if (!mask) return -ENOMEM; @@ -1366,7 +1365,7 @@ out_no_maps: rcu_read_unlock(); len = bitmap_print_to_pagebuf(false, buf, mask, dev->num_rx_queues); - kfree(mask); + bitmap_free(mask); return len < PAGE_SIZE ? len : -EINVAL; } @@ -1382,8 +1381,7 @@ static ssize_t xps_rxqs_store(struct netdev_queue *queue, const char *buf, if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) return -EPERM; - mask = kcalloc(BITS_TO_LONGS(dev->num_rx_queues), sizeof(long), - GFP_KERNEL); + mask = bitmap_zalloc(dev->num_rx_queues, GFP_KERNEL); if (!mask) return -ENOMEM; @@ -1391,7 +1389,7 @@ static ssize_t xps_rxqs_store(struct netdev_queue *queue, const char *buf, err = bitmap_parse(buf, len, mask, dev->num_rx_queues); if (err) { - kfree(mask); + bitmap_free(mask); return err; } @@ -1399,7 +1397,7 @@ static ssize_t xps_rxqs_store(struct netdev_queue *queue, const char *buf, err = __netif_set_xps_queue(dev, mask, index, true); cpus_read_unlock(); - kfree(mask); + bitmap_free(mask); return err ? : len; } |