]> git.baikalelectronics.ru Git - kernel.git/commit
iio: __iio_update_buffers: Slightly refactor scan mask memory management
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 13 May 2015 14:04:45 +0000 (16:04 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 17 May 2015 08:45:22 +0000 (09:45 +0100)
commit2a37f7681821d444981aaf5ab214f0ce135ce0bb
treee42c9d84daba621a14f7f53518f628db0bce848b
parent2657b200327d275d416006c7a45f837f5a960ac5
iio: __iio_update_buffers: Slightly refactor scan mask memory management

Add a small helper function iio_free_scan_mask() that takes a mask and
frees its memory if the scan masks for the device are dynamically
allocated, otherwise does nothing. This means we don't have to open-code
the same check over and over again in __iio_update_buffers.

Also free compound_mask as soon a we are done using it. This constrains its
usage to a specific region of the function will make further refactoring
and splitting the function into smaller sub-parts more easier.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/industrialio-buffer.c