Skip to content

Commit c5dc459

Browse files
committed
Correct return code of e4k_reg_write().
In contradiction with the documentation, e4k_reg_write() was returning the value 2 upon success (the number of bytes written), not zero as documented. Patched to return zero upon success. As a consequence, this corrects also the return value of e4k_reg_set_mask() and e4k_dc_offset_calibrate().
1 parent d447a2e commit c5dc459

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tuner_e4k.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ static const uint8_t width2mask[] = {
6464
*/
6565
static int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val)
6666
{
67+
int r;
6768
uint8_t data[2];
6869
data[0] = reg;
6970
data[1] = val;
7071

71-
return rtlsdr_i2c_write_fn(e4k->rtl_dev, e4k->i2c_addr, data, 2);
72+
r = rtlsdr_i2c_write_fn(e4k->rtl_dev, e4k->i2c_addr, data, 2);
73+
return r == 2 ? 0 : -1;
7274
}
7375

7476
/*! \brief Read a register of the tuner chip

0 commit comments

Comments
 (0)