aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2013-11-27 15:23:00 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-12-04 12:22:58 -0500
commit9323297dc0ea9141f8099e474657391bb3ad98f8 (patch)
tree7259406310102cdf5b27048bf4eeb5046ef01645
parent3af41a337a5b270de3e65466a07f106ad97ad0c6 (diff)
[media] af9035: fix broken I2C and USB I/O
There was three small buffer len calculation bugs which caused driver non-working. These are coming from recent commit: commit 7760e148350bf6df95662bc0db3734e9d991cb03 [media] af9035: Don't use dynamic static allocation Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Cc: stable@vger.kernel.org
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9035.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 798565c4bb3e..4453b0b3143a 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -131,7 +131,7 @@ static int af9035_wr_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len)
131{ 131{
132 u8 wbuf[MAX_XFER_SIZE]; 132 u8 wbuf[MAX_XFER_SIZE];
133 u8 mbox = (reg >> 16) & 0xff; 133 u8 mbox = (reg >> 16) & 0xff;
134 struct usb_req req = { CMD_MEM_WR, mbox, sizeof(wbuf), wbuf, 0, NULL }; 134 struct usb_req req = { CMD_MEM_WR, mbox, 6 + len, wbuf, 0, NULL };
135 135
136 if (6 + len > sizeof(wbuf)) { 136 if (6 + len > sizeof(wbuf)) {
137 dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n", 137 dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n",
@@ -238,7 +238,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
238 } else { 238 } else {
239 /* I2C */ 239 /* I2C */
240 u8 buf[MAX_XFER_SIZE]; 240 u8 buf[MAX_XFER_SIZE];
241 struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf), 241 struct usb_req req = { CMD_I2C_RD, 0, 5 + msg[0].len,
242 buf, msg[1].len, msg[1].buf }; 242 buf, msg[1].len, msg[1].buf };
243 243
244 if (5 + msg[0].len > sizeof(buf)) { 244 if (5 + msg[0].len > sizeof(buf)) {
@@ -274,8 +274,8 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
274 } else { 274 } else {
275 /* I2C */ 275 /* I2C */
276 u8 buf[MAX_XFER_SIZE]; 276 u8 buf[MAX_XFER_SIZE];
277 struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf, 277 struct usb_req req = { CMD_I2C_WR, 0, 5 + msg[0].len,
278 0, NULL }; 278 buf, 0, NULL };
279 279
280 if (5 + msg[0].len > sizeof(buf)) { 280 if (5 + msg[0].len > sizeof(buf)) {
281 dev_warn(&d->udev->dev, 281 dev_warn(&d->udev->dev,