]> git.baikalelectronics.ru Git - kernel.git/commit
iio: inkern: fix return value in devm_of_iio_channel_get_by_name()
authorNuno Sá <nuno.sa@analog.com>
Fri, 15 Jul 2022 12:28:50 +0000 (14:28 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 15 Aug 2022 21:29:59 +0000 (22:29 +0100)
commitd3ac97733d27db0b1c79cf8db4b8b324fc61edc6
tree524aef542f31e9333e70b729e8ef93c2b9f34801
parentf29dd5689d70700d31cdaf4099dc9939179540cf
iio: inkern: fix return value in devm_of_iio_channel_get_by_name()

of_iio_channel_get_by_name() can either return NULL or an error pointer
so that only doing IS_ERR() is not enough. Fix it by checking the NULL
pointer case and return -ENODEV in that case. Note this is done like this
so that users of the function (which only check for error pointers) do
not need to be changed. This is not ideal since we are losing error codes
and as such, in a follow up change, things will be unified so that
of_iio_channel_get_by_name() only returns error codes.

Fixes: 66395f5e113d ("iio: provide of_iio_channel_get_by_name() and devm_ version it")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/inkern.c