From: Michael Krufky Date: Thu, 15 Dec 2011 13:16:09 +0000 (-0300) Subject: [media] lgdt330x: fix behavior of read errors in lgdt330x_read_ucblocks X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=26110dac8b3b30a99555d85fc1308a21fba5b746;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [media] lgdt330x: fix behavior of read errors in lgdt330x_read_ucblocks initialize *ucblocks to zero & fix the following build warning: lgdt330x.c: In function "lgdt330x_read_ucblocks": lgdt330x.c:288:6: warning: variable "err" set but not used [-Wunused-but-set-variable] Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 43971e63baa7..d45827158a24 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c @@ -288,6 +288,8 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) int err; u8 buf[2]; + *ucblocks = 0; + switch (state->config->demod_chip) { case LGDT3302: err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1, @@ -302,6 +304,8 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) "Only LGDT3302 and LGDT3303 are supported chips.\n"); err = -ENODEV; } + if (err < 0) + return err; *ucblocks = (buf[0] << 8) | buf[1]; return 0;