aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2006-05-22 19:39:20 -0400
committerDavid S. Miller <davem@davemloft.net>2006-05-22 19:39:20 -0400
commitae181bc44c65fdc93d0d2d908534b22e43f60f56 (patch)
tree1b3e93698455063d88c130cb7407a7b2c4dc3100 /drivers/net/bnx2.c
parentbae25761c92c5eec781b6ea72bbe7e98fc8382a0 (diff)
[BNX2]: Use kmalloc instead of array
Use kmalloc() instead of a local array in bnx2_nvram_write(). Update version to 1.4.40. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 509f104ec3db..54161aef3cac 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -55,8 +55,8 @@
55 55
56#define DRV_MODULE_NAME "bnx2" 56#define DRV_MODULE_NAME "bnx2"
57#define PFX DRV_MODULE_NAME ": " 57#define PFX DRV_MODULE_NAME ": "
58#define DRV_MODULE_VERSION "1.4.39" 58#define DRV_MODULE_VERSION "1.4.40"
59#define DRV_MODULE_RELDATE "March 22, 2006" 59#define DRV_MODULE_RELDATE "May 22, 2006"
60 60
61#define RUN_AT(x) (jiffies + (x)) 61#define RUN_AT(x) (jiffies + (x))
62 62
@@ -2945,7 +2945,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
2945 int buf_size) 2945 int buf_size)
2946{ 2946{
2947 u32 written, offset32, len32; 2947 u32 written, offset32, len32;
2948 u8 *buf, start[4], end[4]; 2948 u8 *buf, start[4], end[4], *flash_buffer = NULL;
2949 int rc = 0; 2949 int rc = 0;
2950 int align_start, align_end; 2950 int align_start, align_end;
2951 2951
@@ -2985,12 +2985,19 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
2985 memcpy(buf + align_start, data_buf, buf_size); 2985 memcpy(buf + align_start, data_buf, buf_size);
2986 } 2986 }
2987 2987
2988 if (bp->flash_info->buffered == 0) {
2989 flash_buffer = kmalloc(264, GFP_KERNEL);
2990 if (flash_buffer == NULL) {
2991 rc = -ENOMEM;
2992 goto nvram_write_end;
2993 }
2994 }
2995
2988 written = 0; 2996 written = 0;
2989 while ((written < len32) && (rc == 0)) { 2997 while ((written < len32) && (rc == 0)) {
2990 u32 page_start, page_end, data_start, data_end; 2998 u32 page_start, page_end, data_start, data_end;
2991 u32 addr, cmd_flags; 2999 u32 addr, cmd_flags;
2992 int i; 3000 int i;
2993 u8 flash_buffer[264];
2994 3001
2995 /* Find the page_start addr */ 3002 /* Find the page_start addr */
2996 page_start = offset32 + written; 3003 page_start = offset32 + written;
@@ -3109,6 +3116,9 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3109 } 3116 }
3110 3117
3111nvram_write_end: 3118nvram_write_end:
3119 if (bp->flash_info->buffered == 0)
3120 kfree(flash_buffer);
3121
3112 if (align_start || align_end) 3122 if (align_start || align_end)
3113 kfree(buf); 3123 kfree(buf);
3114 return rc; 3124 return rc;