Re: [PATCH RFC 2/7] hwmon: (adc128d818) Use devm_regulator_get_optional_enable_get_voltage()

Jonathan Cameron
2024-03-28T14:05:41Z

On Wed, 27 Mar 2024 18:18:51 -0500
David Lechner <dlechner@baylibre.com> wrote:

> We can reduce boilerplate code and eliminate the driver remove()
> function by using devm_regulator_get_optional_enable_get_voltage().
>
> A new external_vref flag is added since we no longer have the handle
> to the regulator to check if it is present.
>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
One trivial thing.
With that tidied up...

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
> data, adc128_groups);
> if (IS_ERR(hwmon_dev)) {
> err = PTR_ERR(hwmon_dev);
> - goto error;
> + return err;

return PTR_ERR()

> }
>
> return 0;
> -
> -error:
> - if (data->regulator)
> - regulator_disable(data->regulator);
> - return err;
> -}