diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-03-23 06:36:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-03-23 06:54:32 -0400 |
commit | d3c449e16fc829dba347dc72106f8d28b15896f9 (patch) | |
tree | f774d668791c831ec5a317e39430a4090721fd76 | |
parent | b0121ca03865ec5fa46f2ffc9d354cd5e5613023 (diff) |
media: bttv-input: better handle errors at I2C transfer
The error handling logic at get_key_pv951() is a little bit
akward, with produces this false positive warning:
drivers/media/pci/bt8xx/bttv-input.c:344 get_key_pv951() error: uninitialized symbol 'b'.
Do a cleanup. As a side effect, it also improves its coding
style.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/pci/bt8xx/bttv-input.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c index da49c5567db5..08266b23826e 100644 --- a/drivers/media/pci/bt8xx/bttv-input.c +++ b/drivers/media/pci/bt8xx/bttv-input.c | |||
@@ -332,11 +332,15 @@ static void bttv_ir_stop(struct bttv *btv) | |||
332 | static int get_key_pv951(struct IR_i2c *ir, enum rc_proto *protocol, | 332 | static int get_key_pv951(struct IR_i2c *ir, enum rc_proto *protocol, |
333 | u32 *scancode, u8 *toggle) | 333 | u32 *scancode, u8 *toggle) |
334 | { | 334 | { |
335 | int rc; | ||
335 | unsigned char b; | 336 | unsigned char b; |
336 | 337 | ||
337 | /* poll IR chip */ | 338 | /* poll IR chip */ |
338 | if (1 != i2c_master_recv(ir->c, &b, 1)) { | 339 | rc = i2c_master_recv(ir->c, &b, 1); |
340 | if (rc != 1) { | ||
339 | dprintk("read error\n"); | 341 | dprintk("read error\n"); |
342 | if (rc < 0) | ||
343 | return rc; | ||
340 | return -EIO; | 344 | return -EIO; |
341 | } | 345 | } |
342 | 346 | ||