]> git.baikalelectronics.ru Git - kernel.git/commit
iio: move 'indio_dev->info' null check first in __iio_device_register()
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Tue, 7 Apr 2020 15:07:43 +0000 (18:07 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Apr 2020 15:56:34 +0000 (16:56 +0100)
commita11d9b00f2483cf684114fba26df2f65cdd45e0d
treefcff5b45ac7531920360618637f6288c5395f77f
parent821e52077a1f635c07512ca5a1baa62477ce1307
iio: move 'indio_dev->info' null check first in __iio_device_register()

Moves this to be the first check, as it's very simple and fails the
registration earlier, instead of potentially initializing the
'indio_dev->label' and checking for duplicate indexes, and then failing
with this simple-check.

This is a minor optimization, since '__iio_device_register()' will waste
fewer validation cycles in case 'indio_dev->info' is NULL.

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