Skip to content

Commit

Permalink
liquidio: Replace vmalloc with kmalloc in octeon_register_dispatch_fn()
Browse files Browse the repository at this point in the history
The size of struct octeon_dispatch is too small, it is better to use
kmalloc instead of vmalloc.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wang Hai authored and David S. Miller committed Jul 31, 2020
1 parent a0d716d commit 1e51f93
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/net/ethernet/cavium/liquidio/octeon_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ void octeon_delete_dispatch_list(struct octeon_device *oct)

list_for_each_safe(temp, tmp2, &freelist) {
list_del(temp);
vfree(temp);
kfree(temp);
}
}

Expand Down Expand Up @@ -1152,13 +1152,10 @@ octeon_register_dispatch_fn(struct octeon_device *oct,

dev_dbg(&oct->pci_dev->dev,
"Adding opcode to dispatch list linked list\n");
dispatch = (struct octeon_dispatch *)
vmalloc(sizeof(struct octeon_dispatch));
if (!dispatch) {
dev_err(&oct->pci_dev->dev,
"No memory to add dispatch function\n");
dispatch = kmalloc(sizeof(*dispatch), GFP_KERNEL);
if (!dispatch)
return 1;
}

dispatch->opcode = combined_opcode;
dispatch->dispatch_fn = fn;
dispatch->arg = fn_arg;
Expand Down

0 comments on commit 1e51f93

Please sign in to comment.