Skip to content

Commit 507397d

Browse files
Dan Carpenterjic23
authored andcommitted
iio: frequency: admv1013: propagate errors from regulator_get_voltage()
The regulator_get_voltage() function returns negative error codes. This function saves it to an unsigned int and then does some range checking and, since the error code falls outside the correct range, it returns -EINVAL. Beyond the messiness, this is bad because the regulator_get_voltage() function can return -EPROBE_DEFER and it's important to propagate that back properly so it can be handled. Fixes: da35a7b ("iio: frequency: admv1013: add support for ADMV1013") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 48faabf commit 507397d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/iio/frequency/admv1013.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,12 @@ static int admv1013_update_quad_filters(struct admv1013_state *st)
344344

345345
static int admv1013_update_mixer_vgate(struct admv1013_state *st)
346346
{
347-
unsigned int vcm, mixer_vgate;
347+
unsigned int mixer_vgate;
348+
int vcm;
348349

349350
vcm = regulator_get_voltage(st->reg);
351+
if (vcm < 0)
352+
return vcm;
350353

351354
if (vcm < 1800000)
352355
mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100;

0 commit comments

Comments
 (0)