diff options
author | Xi Wang <xi.wang@gmail.com> | 2012-02-14 12:32:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-03-08 07:01:12 -0500 |
commit | 34817174fca0c5512c2d5b6ea0fc37a0337ce1d8 (patch) | |
tree | c5dccf4f4b2350089e13d1173d1854382aff7d52 /drivers | |
parent | bdb2c41fc12b627e0e870b141341ded5772bab70 (diff) |
[media] lgdt330x: fix signedness error in i2c_read_demod_bytes()
The error handling in lgdt3303_read_status() and lgdt330x_read_ucblocks()
doesn't work, because i2c_read_demod_bytes() returns a u8 and (err < 0)
is always false.
err = i2c_read_demod_bytes(state, 0x58, buf, 1);
if (err < 0)
return err;
Change the return type of i2c_read_demod_bytes() to int. Also change
the return value on error to -EIO to make (err < 0) work.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/lgdt330x.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index c990d35a13dc..e046622df0e4 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c | |||
@@ -104,8 +104,8 @@ static int i2c_write_demod_bytes (struct lgdt330x_state* state, | |||
104 | * then reads the data returned for (len) bytes. | 104 | * then reads the data returned for (len) bytes. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | static u8 i2c_read_demod_bytes (struct lgdt330x_state* state, | 107 | static int i2c_read_demod_bytes(struct lgdt330x_state *state, |
108 | enum I2C_REG reg, u8* buf, int len) | 108 | enum I2C_REG reg, u8 *buf, int len) |
109 | { | 109 | { |
110 | u8 wr [] = { reg }; | 110 | u8 wr [] = { reg }; |
111 | struct i2c_msg msg [] = { | 111 | struct i2c_msg msg [] = { |
@@ -118,6 +118,8 @@ static u8 i2c_read_demod_bytes (struct lgdt330x_state* state, | |||
118 | ret = i2c_transfer(state->i2c, msg, 2); | 118 | ret = i2c_transfer(state->i2c, msg, 2); |
119 | if (ret != 2) { | 119 | if (ret != 2) { |
120 | printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __func__, state->config->demod_address, reg, ret); | 120 | printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __func__, state->config->demod_address, reg, ret); |
121 | if (ret >= 0) | ||
122 | ret = -EIO; | ||
121 | } else { | 123 | } else { |
122 | ret = 0; | 124 | ret = 0; |
123 | } | 125 | } |