提交 c3902dab 编写于 作者: M Mauro Carvalho Chehab

media: ir-kbd-i2c: improve error handling code

The current I2C error handling logic makes static analyzers
confused, and it doesn't follow the coding style we're using:

	drivers/media/i2c/ir-kbd-i2c.c:180 get_key_pixelview() error: uninitialized symbol 'b'.
	drivers/media/i2c/ir-kbd-i2c.c:224 get_key_knc1() error: uninitialized symbol 'b'.
	drivers/media/i2c/ir-kbd-i2c.c:226 get_key_knc1() error: uninitialized symbol 'b'.
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 5fd46ac9
...@@ -168,11 +168,15 @@ static int get_key_haup_xvr(struct IR_i2c *ir, enum rc_proto *protocol, ...@@ -168,11 +168,15 @@ static int get_key_haup_xvr(struct IR_i2c *ir, enum rc_proto *protocol,
static int get_key_pixelview(struct IR_i2c *ir, enum rc_proto *protocol, static int get_key_pixelview(struct IR_i2c *ir, enum rc_proto *protocol,
u32 *scancode, u8 *toggle) u32 *scancode, u8 *toggle)
{ {
int rc;
unsigned char b; unsigned char b;
/* poll IR chip */ /* poll IR chip */
if (1 != i2c_master_recv(ir->c, &b, 1)) { rc = i2c_master_recv(ir->c, &b, 1);
if (rc != 1) {
dev_dbg(&ir->rc->dev, "read error\n"); dev_dbg(&ir->rc->dev, "read error\n");
if (rc < 0)
return rc;
return -EIO; return -EIO;
} }
...@@ -185,11 +189,15 @@ static int get_key_pixelview(struct IR_i2c *ir, enum rc_proto *protocol, ...@@ -185,11 +189,15 @@ static int get_key_pixelview(struct IR_i2c *ir, enum rc_proto *protocol,
static int get_key_fusionhdtv(struct IR_i2c *ir, enum rc_proto *protocol, static int get_key_fusionhdtv(struct IR_i2c *ir, enum rc_proto *protocol,
u32 *scancode, u8 *toggle) u32 *scancode, u8 *toggle)
{ {
int rc;
unsigned char buf[4]; unsigned char buf[4];
/* poll IR chip */ /* poll IR chip */
if (4 != i2c_master_recv(ir->c, buf, 4)) { rc = i2c_master_recv(ir->c, buf, 4);
if (rc != 4) {
dev_dbg(&ir->rc->dev, "read error\n"); dev_dbg(&ir->rc->dev, "read error\n");
if (rc < 0)
return rc;
return -EIO; return -EIO;
} }
...@@ -209,11 +217,15 @@ static int get_key_fusionhdtv(struct IR_i2c *ir, enum rc_proto *protocol, ...@@ -209,11 +217,15 @@ static int get_key_fusionhdtv(struct IR_i2c *ir, enum rc_proto *protocol,
static int get_key_knc1(struct IR_i2c *ir, enum rc_proto *protocol, static int get_key_knc1(struct IR_i2c *ir, enum rc_proto *protocol,
u32 *scancode, u8 *toggle) u32 *scancode, u8 *toggle)
{ {
int rc;
unsigned char b; unsigned char b;
/* poll IR chip */ /* poll IR chip */
if (1 != i2c_master_recv(ir->c, &b, 1)) { rc = i2c_master_recv(ir->c, &b, 1);
if (rc != 1) {
dev_dbg(&ir->rc->dev, "read error\n"); dev_dbg(&ir->rc->dev, "read error\n");
if (rc < 0)
return rc;
return -EIO; return -EIO;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册