From 59198d63422685470f52f633251d3859104de5b0 Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Sat, 5 May 2012 02:19:34 +0200 Subject: [PATCH] tuner_e4k: fix off-by-one error in e4k_if_gain_set() Thanks to patchvonbraun for providing debug logs that helped to track this beast down. Signed-off-by: Steve Markgraf --- src/tuner_e4k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tuner_e4k.c b/src/tuner_e4k.c index b530812..08b812a 100644 --- a/src/tuner_e4k.c +++ b/src/tuner_e4k.c @@ -715,7 +715,7 @@ int e4k_if_gain_set(struct e4k_state *e4k, uint8_t stage, int8_t value) return rc; /* compute the bit-mask for the given gain field */ - field = &if_stage_gain_regs[stage]; + field = &if_stage_gain_regs[stage-1]; mask = width2mask[field->width] << field->shift; return e4k_reg_set_mask(e4k, field->reg, mask, rc << field->shift);