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)
commit0d4b2184cfee8293203fc22029b081dbbec9b879
tree2d9c33bb8bcd685be32c2aba87183b274e3699cf
parent151e91733a79403119d2ac8f4fe9870e7b4d75ac
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