Commit 1bfd5294 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] af9035: check I/O errors on IR polling

Use more careful error checks.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3bf5e552
...@@ -100,6 +100,10 @@ static int af9035_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req) ...@@ -100,6 +100,10 @@ static int af9035_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req)
/* check status */ /* check status */
if (state->buf[2]) { if (state->buf[2]) {
/* fw returns status 1 when IR code was not received */
if (req->cmd == CMD_IR_GET || state->buf[2] == 1)
return 1;
dev_dbg(&d->udev->dev, "%s: command=%02x failed fw error=%d\n", dev_dbg(&d->udev->dev, "%s: command=%02x failed fw error=%d\n",
__func__, req->cmd, state->buf[2]); __func__, req->cmd, state->buf[2]);
ret = -EIO; ret = -EIO;
...@@ -1223,7 +1227,9 @@ static int af9035_rc_query(struct dvb_usb_device *d) ...@@ -1223,7 +1227,9 @@ static int af9035_rc_query(struct dvb_usb_device *d)
struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, b }; struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, b };
ret = af9035_ctrl_msg(d, &req); ret = af9035_ctrl_msg(d, &req);
if (ret < 0) if (ret == 1)
return 0;
else if (ret < 0)
goto err; goto err;
if ((b[2] + b[3]) == 0xff) { if ((b[2] + b[3]) == 0xff) {
...@@ -1240,9 +1246,12 @@ static int af9035_rc_query(struct dvb_usb_device *d) ...@@ -1240,9 +1246,12 @@ static int af9035_rc_query(struct dvb_usb_device *d)
rc_keydown(d->rc_dev, key, 0); rc_keydown(d->rc_dev, key, 0);
err:
/* ignore errors */
return 0; return 0;
err:
dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
return ret;
} }
static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment