Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: afe: iio-rescale: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20200829064726.26268-9-krzk@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Krzysztof Kozlowski and committed by
Jonathan Cameron
bfa96be8 ce30eeb6

+3 -5
+3 -5
drivers/iio/afe/iio-rescale.c
··· 276 276 int ret; 277 277 278 278 source = devm_iio_channel_get(dev, NULL); 279 - if (IS_ERR(source)) { 280 - if (PTR_ERR(source) != -EPROBE_DEFER) 281 - dev_err(dev, "failed to get source channel\n"); 282 - return PTR_ERR(source); 283 - } 279 + if (IS_ERR(source)) 280 + return dev_err_probe(dev, PTR_ERR(source), 281 + "failed to get source channel\n"); 284 282 285 283 sizeof_ext_info = iio_get_channel_ext_info_count(source); 286 284 if (sizeof_ext_info) {