]> git.baikalelectronics.ru Git - kernel.git/commit
iio: Use an early return in iio_device_alloc to simplify code.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Apr 2020 15:13:37 +0000 (16:13 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 3 May 2020 08:47:18 +0000 (09:47 +0100)
commit971e1b870a6cba2d43092afa3a86f324d106c54a
tree2d9c33bb8bcd685be32c2aba87183b274e3699cf
parent33efeeb2e7a65b1a623868e0957299e7f74c1773
iio: Use an early return in iio_device_alloc to simplify code.

Noticed whilst reviewing Alexandru's patch to the same function.
If we simply flip the logic and return NULL immediately after memory
allocation failure we reduce the indent of the following block and
end up with more 'idiomatic' kernel code.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
drivers/iio/industrialio-core.c