diff options
author | Antti Palosaari <crope@iki.fi> | 2013-03-08 15:39:12 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-21 18:06:13 -0400 |
commit | 1bfd5294ddb8b3d3ac05f609334070454b5ef96f (patch) | |
tree | 0cbe45e46f53ed93150f8f78661d0ab841b9257e | |
parent | 3bf5e55299ac5a389a4e6b9991f900579a765172 (diff) |
[media] af9035: check I/O errors on IR polling
Use more careful error checks.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 735646d4f34a..5d6b3713e035 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -100,6 +100,10 @@ static int af9035_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req) | |||
100 | 100 | ||
101 | /* check status */ | 101 | /* check status */ |
102 | if (state->buf[2]) { | 102 | if (state->buf[2]) { |
103 | /* fw returns status 1 when IR code was not received */ | ||
104 | if (req->cmd == CMD_IR_GET || state->buf[2] == 1) | ||
105 | return 1; | ||
106 | |||
103 | dev_dbg(&d->udev->dev, "%s: command=%02x failed fw error=%d\n", | 107 | dev_dbg(&d->udev->dev, "%s: command=%02x failed fw error=%d\n", |
104 | __func__, req->cmd, state->buf[2]); | 108 | __func__, req->cmd, state->buf[2]); |
105 | ret = -EIO; | 109 | ret = -EIO; |
@@ -1223,7 +1227,9 @@ static int af9035_rc_query(struct dvb_usb_device *d) | |||
1223 | struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, b }; | 1227 | struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, b }; |
1224 | 1228 | ||
1225 | ret = af9035_ctrl_msg(d, &req); | 1229 | ret = af9035_ctrl_msg(d, &req); |
1226 | if (ret < 0) | 1230 | if (ret == 1) |
1231 | return 0; | ||
1232 | else if (ret < 0) | ||
1227 | goto err; | 1233 | goto err; |
1228 | 1234 | ||
1229 | if ((b[2] + b[3]) == 0xff) { | 1235 | if ((b[2] + b[3]) == 0xff) { |
@@ -1240,9 +1246,12 @@ static int af9035_rc_query(struct dvb_usb_device *d) | |||
1240 | 1246 | ||
1241 | rc_keydown(d->rc_dev, key, 0); | 1247 | rc_keydown(d->rc_dev, key, 0); |
1242 | 1248 | ||
1243 | err: | ||
1244 | /* ignore errors */ | ||
1245 | return 0; | 1249 | return 0; |
1250 | |||
1251 | err: | ||
1252 | dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); | ||
1253 | |||
1254 | return ret; | ||
1246 | } | 1255 | } |
1247 | 1256 | ||
1248 | static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) | 1257 | static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) |