Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250191
b: refs/heads/master
c: ee52f12
h: refs/heads/master
i:
  250189: f3fcd4d
  250187: d50878e
  250183: 2421cc8
  250175: eba06a0
v: v3
  • Loading branch information
Florian Mickler authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 75b12cb commit 58f6d57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ea793aa736137aa2453ce6877bb31a4b15dc28d
refs/heads/master: ee52f120b0adc469f5c67815cef79ecdd01cfd14
23 changes: 19 additions & 4 deletions trunk/drivers/media/dvb/dvb-usb/vp702x.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,28 @@ int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int il
static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o,
int olen, u8 *i, int ilen, int msec)
{
struct vp702x_device_state *st = d->priv;
int ret = 0;
u8 *buf;
int buflen = max(olen + 2, ilen + 1);

buf = kmalloc(buflen, GFP_KERNEL);
if (!buf)
return -ENOMEM;
ret = mutex_lock_interruptible(&st->buf_mutex);
if (ret < 0)
return ret;

if (buflen > st->buf_len) {
buf = kmalloc(buflen, GFP_KERNEL);
if (!buf) {
mutex_unlock(&st->buf_mutex);
return -ENOMEM;
}
info("successfully reallocated a bigger buffer");
kfree(st->buf);
st->buf = buf;
st->buf_len = buflen;
} else {
buf = st->buf;
}

buf[0] = 0x00;
buf[1] = cmd;
Expand All @@ -132,8 +147,8 @@ static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o,

if (ret == 0)
memcpy(i, &buf[1], ilen);
mutex_unlock(&st->buf_mutex);

kfree(buf);
return ret;
}

Expand Down

0 comments on commit 58f6d57

Please sign in to comment.