Re: [PATCH 2/3] iio: adc: Support ROHM BD79112 ADC/GPIO
From: Matti Vaittinen <mazziesaccount@gmail.com>
Date: 2025-09-05 05:47:48
Also in:
linux-gpio, linux-iio, lkml
From: Matti Vaittinen <mazziesaccount@gmail.com>
Date: 2025-09-05 05:47:48
Also in:
linux-gpio, linux-iio, lkml
On 02/09/2025 17:15, Andy Shevchenko wrote:
quoted
+ ret = devm_iio_adc_device_alloc_chaninfo_se(dev, &bd79112_chan_template, + BD79112_MAX_NUM_CHANNELS - 1, &cs);Hmm... Indentation can be amended.quoted
+ if (ret < 0) {Why ' < 0' ?quoted
+ /* Register all pins as GPIOs if there are no ADC channels */ + if (ret == -ENOENT) + goto register_gpios; + + return ret; + }Assuming ret can't be positive this can be refactored as:
I returned back to this after reading your comment to v2. ret can be positive.
/* Register all pins as GPIOs if there are no ADC channels */ if (ret == -ENOENT) goto register_gpios; else if (ret) return ret; I find it easier to follow.
I still kinda like your suggestion. I'll change this to something like
below for v3:
/* Register all pins as GPIOs if there are no ADC channels */
if (ret == -ENOENT)
goto register_gpios;
if (ret < 0)
return ret;
Thanks again!
Yours,
-- Matti