iio: buffer: Save a few cycles in 'iio_scan_mask_set()'
Use 'bitmap_alloc()' instead of 'bitmap_zalloc()' because the bitmap is fully overridden by a 'bitmap_copy()' call just after its allocation. While at it, fix the style of a NULL check. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/89d8a766eb971eda1ee362444a8711037bdb208c.1626261211.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Родитель
62f9eb7079
Коммит
458516508d
|
@ -354,8 +354,8 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
|
|||
const unsigned long *mask;
|
||||
unsigned long *trialmask;
|
||||
|
||||
trialmask = bitmap_zalloc(indio_dev->masklength, GFP_KERNEL);
|
||||
if (trialmask == NULL)
|
||||
trialmask = bitmap_alloc(indio_dev->masklength, GFP_KERNEL);
|
||||
if (!trialmask)
|
||||
return -ENOMEM;
|
||||
if (!indio_dev->masklength) {
|
||||
WARN(1, "Trying to set scanmask prior to registering buffer\n");
|
||||
|
|
Загрузка…
Ссылка в новой задаче