Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264921
b: refs/heads/master
c: 065e609
h: refs/heads/master
i:
  264919: 493670f
v: v3
  • Loading branch information
Adam Cozzette authored and Greg Kroah-Hartman committed Aug 24, 2011
1 parent 7133c7e commit f5064bb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 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: 5de9ec4dc10e1a39b924fb165bcb3ddb6e8e6525
refs/heads/master: 065e60964e293227e4feb0c1f7e27e609316ed9a
35 changes: 30 additions & 5 deletions trunk/drivers/usb/storage/realtek_cr.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
{
int retval;
u8 cmnd[12] = { 0 };
u8 *buf;

buf = kmalloc(len, GFP_NOIO);
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;

US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);

Expand All @@ -331,17 +336,27 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
cmnd[5] = (u8) len;

retval = rts51x_bulk_transport(us, 0, cmnd, 12,
data, len, DMA_FROM_DEVICE, NULL);
if (retval != USB_STOR_TRANSPORT_GOOD)
buf, len, DMA_FROM_DEVICE, NULL);
if (retval != USB_STOR_TRANSPORT_GOOD) {
kfree(buf);
return -EIO;
}

memcpy(data, buf, len);
kfree(buf);
return 0;
}

static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
{
int retval;
u8 cmnd[12] = { 0 };
u8 *buf;

buf = kmalloc(len, GFP_NOIO);
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;
memcpy(buf, data, len);

US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);

Expand All @@ -353,7 +368,8 @@ static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
cmnd[5] = (u8) len;

retval = rts51x_bulk_transport(us, 0, cmnd, 12,
data, len, DMA_TO_DEVICE, NULL);
buf, len, DMA_TO_DEVICE, NULL);
kfree(buf);
if (retval != USB_STOR_TRANSPORT_GOOD)
return -EIO;

Expand All @@ -365,17 +381,26 @@ static int rts51x_read_status(struct us_data *us,
{
int retval;
u8 cmnd[12] = { 0 };
u8 *buf;

buf = kmalloc(len, GFP_NOIO);
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;

US_DEBUGP("%s, lun = %d\n", __func__, lun);

cmnd[0] = 0xF0;
cmnd[1] = 0x09;

retval = rts51x_bulk_transport(us, lun, cmnd, 12,
status, len, DMA_FROM_DEVICE, actlen);
if (retval != USB_STOR_TRANSPORT_GOOD)
buf, len, DMA_FROM_DEVICE, actlen);
if (retval != USB_STOR_TRANSPORT_GOOD) {
kfree(buf);
return -EIO;
}

memcpy(status, buf, len);
kfree(buf);
return 0;
}

Expand Down

0 comments on commit f5064bb

Please sign in to comment.