Re: [PATCH v2 3/4] iio: light: stk3310: add vdd regulator support

From: Jonathan Cameron

Date: Wed Nov 18 2026 - 22:32:58 EST


On Wed, 18 Nov 2026 11:01:38 +0100
Joshua Crofts <crofts@xxxxxxxxxx> wrote:

> On Tue, 17 Nov 2026 20:08:37 +0200
> Roman Vivchar via B4 Relay <devnull+rva333.protonmail.com@xxxxxxxxxx> wrote:
>
> > @@ -745,6 +746,10 @@ static int stk3310_probe(struct i2c_client *client)
> > device_property_read_u32(&client->dev, "proximity-near-level",
> > &data->ps_near_level);
> >
> > + ret = devm_regulator_get_enable(dev, "vdd");
> > + if (ret)
> > + return dev_err_probe(dev, ret, "failed to get vdd supply\n");
> > +
>
> IMO this should work, but I don't like the mixing of devm_* and non-devm_*
> functions, this may cause issues down the road. Consider moving the driver
> to all devm_* functions?

In this particular case I agree with you because the conversion is very
simple. Generally the rule of thumb is that devm from start of probe
until you decide to stop, then no more devm. In that case the unwind
order should be correct. This change doesn't break that, but the
driver already breaks this wrt to the interrupt, so if Roman
doesn't mind would be great to fix it whilst touching the driver.

Jonathan