diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-03-04 10:55:40 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-04-04 20:19:51 +0100 |
commit | 3862828a903d3c2b1e9415dca0f4f5d9de52e836 (patch) | |
tree | 70f16353ffc0ea5f0bba8c1038e8fbed39e99fa9 /drivers/iio/buffer | |
parent | 74c420e0a581c2e333c2f5742506e86f198af70b (diff) | |
download | linux-riscv-3862828a903d3c2b1e9415dca0f4f5d9de52e836.tar.gz linux-riscv-3862828a903d3c2b1e9415dca0f4f5d9de52e836.tar.bz2 linux-riscv-3862828a903d3c2b1e9415dca0f4f5d9de52e836.zip |
iio: buffer: 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/buffer')
-rw-r--r-- | drivers/iio/buffer/industrialio-buffer-cb.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/iio/buffer/industrialio-buffer-cb.c b/drivers/iio/buffer/industrialio-buffer-cb.c index ea63c838eeae..df21e7dbec40 100644 --- a/drivers/iio/buffer/industrialio-buffer-cb.c +++ b/drivers/iio/buffer/industrialio-buffer-cb.c @@ -36,7 +36,8 @@ static int iio_buffer_cb_store_to(struct iio_buffer *buffer, const void *data) static void iio_buffer_cb_release(struct iio_buffer *buffer) { struct iio_cb_buffer *cb_buff = buffer_to_cb_buffer(buffer); - kfree(cb_buff->buffer.scan_mask); + + bitmap_free(cb_buff->buffer.scan_mask); kfree(cb_buff); } @@ -74,9 +75,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, } cb_buff->indio_dev = cb_buff->channels[0].indio_dev; - cb_buff->buffer.scan_mask - = kcalloc(BITS_TO_LONGS(cb_buff->indio_dev->masklength), - sizeof(long), GFP_KERNEL); + cb_buff->buffer.scan_mask = bitmap_zalloc(cb_buff->indio_dev->masklength, + GFP_KERNEL); if (cb_buff->buffer.scan_mask == NULL) { ret = -ENOMEM; goto error_release_channels; @@ -95,7 +95,7 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, return cb_buff; error_free_scan_mask: - kfree(cb_buff->buffer.scan_mask); + bitmap_free(cb_buff->buffer.scan_mask); error_release_channels: iio_channel_release_all(cb_buff->channels); error_free_cb_buff: |