Michael Chan wrote:
Combine two small (56 byte and 320 byte) pci consistent memory
allocations into one allocation.
Use kzalloc() instead of kmalloc() + memset().
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index c56888e..b6395ea 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -359,15 +359,14 @@ bnx2_free_mem(struct bnx2 *bp)
{
int i;
- if (bp->stats_blk) {
- pci_free_consistent(bp->pdev, sizeof(struct statistics_block),
- bp->stats_blk, bp->stats_blk_mapping);
- bp->stats_blk = NULL;
- }
if (bp->status_blk) {
- pci_free_consistent(bp->pdev, sizeof(struct status_block),
- bp->status_blk, bp->status_blk_mapping);
+ int size = L1_CACHE_ALIGN(sizeof(struct status_block)) +
+ sizeof(struct statistics_block);
+
+ pci_free_consistent(bp->pdev, size, bp->status_blk,
+ bp->status_blk_mapping);
IMO it is less error-prone to simply store the allocation size, for
later reuse. Sure, you can recalculate it, but why bother duplicating
the calculation code?
Jeff
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html