Re: [PATCH RFC 2/7] hwmon: (adc128d818) Use devm_regulator_get_optional_enable_get_voltage()
From: Jonathan Cameron
Date: Thu Mar 28 2024 - 10:06:06 EST
On Wed, 27 Mar 2024 18:18:51 -0500
David Lechner <dlechner@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
One trivial thing.
With that tidied up...
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> 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;
> -}