Skip to contentSkip to conversation

iio: frequency: admv4420: return proper error code from admv4420_calc_parameters()

PATCH In review Antoniu Miclaus 2 participants 2 messages Jan 30 – Jan 31

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: frequency: admv4420: return proper error code from admv4420_calc_parameters()

Return -EINVAL instead of -1 when no valid PLL parameters solution is found. Using standard kernel error codes ensures consistency and proper error propagation through the call chain.

---
 drivers/iio/frequency/admv4420.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/admv4420.c +1 -1
index 3ae462b4f5c9..8748d9747639 100644
@@ -243,7 +243,7 @@ static int admv4420_calc_parameters(struct admv4420_state *st)
 		st->n_counter.n_counter = 1;
 	}
 	if (!sol_found)
-		return -1;
+		return -EINVAL;
 
 	st->n_counter.int_val = div_u64_rem(st->n_counter.n_counter, 10, &st->n_counter.frac_val);
 	st->n_counter.mod_val = 10;
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 5 lines · On Fri, 30 Jan 2026 15:50:05 +0200 Antoniu Miclaus…

Return -EINVAL instead of -1 when no valid PLL parameters solution is found. Using standard kernel error codes ensures consistency and proper error propagation through the call chain.

Applied to a local branch. I'll need to rebase on something sensible after the merge window. For now I'll push out as testing.

Thanks

Jonathan

Quoted 17 lines
---
 drivers/iio/frequency/admv4420.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/admv4420.c +1 -1
index 3ae462b4f5c9..8748d9747639 100644
@@ -243,7 +243,7 @@ static int admv4420_calc_parameters(struct admv4420_state *st)
 		st->n_counter.n_counter = 1;
 	}
 	if (!sol_found)
-		return -1;
+		return -EINVAL;
 
 	st->n_counter.int_val = div_u64_rem(st->n_counter.n_counter, 10, &st->n_counter.frac_val);
 	st->n_counter.mod_val = 10;