Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193144
b: refs/heads/master
c: 32ec457
h: refs/heads/master
v: v3
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed May 19, 2010
1 parent 16e1385 commit 1fb74bb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 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: 9723dbb034e45775037c5dd098652e1628a1c9ef
refs/heads/master: 32ec4576c3fb37316b1d11a04b220527822f3f0d
50 changes: 41 additions & 9 deletions trunk/drivers/media/dvb/dvb-usb/az6027.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,15 @@ static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca,
u16 value;
u16 index;
int blen;
u8 b[12];
u8 *b;

if (slot != 0)
return -EINVAL;

b = kmalloc(12, GFP_KERNEL);
if (!b)
return -ENOMEM;

mutex_lock(&state->ca_mutex);

req = 0xC1;
Expand All @@ -438,6 +442,7 @@ static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca,
}

mutex_unlock(&state->ca_mutex);
kfree(b);
return ret;
}

Expand Down Expand Up @@ -485,11 +490,15 @@ static int az6027_ci_read_cam_control(struct dvb_ca_en50221 *ca,
u16 value;
u16 index;
int blen;
u8 b[12];
u8 *b;

if (slot != 0)
return -EINVAL;

b = kmalloc(12, GFP_KERNEL);
if (!b)
return -ENOMEM;

mutex_lock(&state->ca_mutex);

req = 0xC3;
Expand All @@ -510,6 +519,7 @@ static int az6027_ci_read_cam_control(struct dvb_ca_en50221 *ca,
}

mutex_unlock(&state->ca_mutex);
kfree(b);
return ret;
}

Expand Down Expand Up @@ -556,7 +566,11 @@ static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot)
u16 value;
u16 index;
int blen;
u8 b[12];
u8 *b;

b = kmalloc(12, GFP_KERNEL);
if (!b)
return -ENOMEM;

req = 0xC8;
value = 0;
Expand All @@ -570,6 +584,7 @@ static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot)
} else{
ret = b[0];
}
kfree(b);
return ret;
}

Expand Down Expand Up @@ -667,8 +682,11 @@ static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int o
u16 value;
u16 index;
int blen;
u8 b[12];
u8 *b;

b = kmalloc(12, GFP_KERNEL);
if (!b)
return -ENOMEM;
mutex_lock(&state->ca_mutex);

req = 0xC5;
Expand All @@ -692,6 +710,7 @@ static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int o
}

mutex_unlock(&state->ca_mutex);
kfree(b);
return ret;
}

Expand Down Expand Up @@ -943,10 +962,16 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n
u16 value;
int length;
u8 req;
u8 data[256];
u8 *data;

data = kmalloc(256, GFP_KERNEL);
if (!data)
return -ENOMEM;

if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
if (mutex_lock_interruptible(&d->i2c_mutex) < 0) {
kfree(data);
return -EAGAIN;
}

if (num > 2)
warn("more than 2 i2c messages at a time is not handled yet. TODO.");
Expand Down Expand Up @@ -1016,6 +1041,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n
}
}
mutex_unlock(&d->i2c_mutex);
kfree(data);

return i;
}
Expand All @@ -1036,8 +1062,14 @@ int az6027_identify_state(struct usb_device *udev,
struct dvb_usb_device_description **desc,
int *cold)
{
u8 b[16];
s16 ret = usb_control_msg(udev,
u8 *b;
s16 ret;

b = kmalloc(16, GFP_KERNEL);
if (!b)
return -ENOMEM;

ret = usb_control_msg(udev,
usb_rcvctrlpipe(udev, 0),
0xb7,
USB_TYPE_VENDOR | USB_DIR_IN,
Expand All @@ -1048,7 +1080,7 @@ int az6027_identify_state(struct usb_device *udev,
USB_CTRL_GET_TIMEOUT);

*cold = ret <= 0;

kfree(b);
deb_info("cold: %d\n", *cold);
return 0;
}
Expand Down

0 comments on commit 1fb74bb

Please sign in to comment.