Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66510
b: refs/heads/master
c: ae94607
h: refs/heads/master
v: v3
  • Loading branch information
Mariusz Kozlowski authored and David S. Miller committed Oct 10, 2007
1 parent d5fa7cd commit 2e8d5e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 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: c477f3348abb5f6fb8b627cfdb1d7ae4b8fe613b
refs/heads/master: ae94607d19028f9805e82da8975c66d3858fcfd8
24 changes: 10 additions & 14 deletions trunk/drivers/net/via-velocity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,14 +1071,12 @@ static int velocity_rx_refill(struct velocity_info *vptr)

static int velocity_init_rd_ring(struct velocity_info *vptr)
{
int ret = -ENOMEM;
unsigned int rsize = sizeof(struct velocity_rd_info) *
vptr->options.numrx;
int ret;

vptr->rd_info = kmalloc(rsize, GFP_KERNEL);
if(vptr->rd_info == NULL)
goto out;
memset(vptr->rd_info, 0, rsize);
vptr->rd_info = kcalloc(vptr->options.numrx,
sizeof(struct velocity_rd_info), GFP_KERNEL);
if (!vptr->rd_info)
return -ENOMEM;

vptr->rd_filled = vptr->rd_dirty = vptr->rd_curr = 0;

Expand All @@ -1088,7 +1086,7 @@ static int velocity_init_rd_ring(struct velocity_info *vptr)
"%s: failed to allocate RX buffer.\n", vptr->dev->name);
velocity_free_rd_ring(vptr);
}
out:

return ret;
}

Expand Down Expand Up @@ -1142,21 +1140,19 @@ static int velocity_init_td_ring(struct velocity_info *vptr)
dma_addr_t curr;
struct tx_desc *td;
struct velocity_td_info *td_info;
unsigned int tsize = sizeof(struct velocity_td_info) *
vptr->options.numtx;

/* Init the TD ring entries */
for (j = 0; j < vptr->num_txq; j++) {
curr = vptr->td_pool_dma[j];

vptr->td_infos[j] = kmalloc(tsize, GFP_KERNEL);
if(vptr->td_infos[j] == NULL)
{
vptr->td_infos[j] = kcalloc(vptr->options.numtx,
sizeof(struct velocity_td_info),
GFP_KERNEL);
if (!vptr->td_infos[j]) {
while(--j >= 0)
kfree(vptr->td_infos[j]);
return -ENOMEM;
}
memset(vptr->td_infos[j], 0, tsize);

for (i = 0; i < vptr->options.numtx; i++, curr += sizeof(struct tx_desc)) {
td = &(vptr->td_rings[j][i]);
Expand Down

0 comments on commit 2e8d5e6

Please sign in to comment.