diff options
author | Michael Chan <mchan@broadcom.com> | 2006-05-22 16:39:20 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-05-22 16:39:20 -0700 |
commit | ae181bc44c65fdc93d0d2d908534b22e43f60f56 (patch) | |
tree | 1b3e93698455063d88c130cb7407a7b2c4dc3100 /drivers | |
parent | bae25761c92c5eec781b6ea72bbe7e98fc8382a0 (diff) | |
download | op-kernel-dev-ae181bc44c65fdc93d0d2d908534b22e43f60f56.zip op-kernel-dev-ae181bc44c65fdc93d0d2d908534b22e43f60f56.tar.gz |
[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')
-rw-r--r-- | drivers/net/bnx2.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 509f104..54161ae 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -55,8 +55,8 @@ #define DRV_MODULE_NAME "bnx2" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "1.4.39" -#define DRV_MODULE_RELDATE "March 22, 2006" +#define DRV_MODULE_VERSION "1.4.40" +#define DRV_MODULE_RELDATE "May 22, 2006" #define RUN_AT(x) (jiffies + (x)) @@ -2945,7 +2945,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, int buf_size) { u32 written, offset32, len32; - u8 *buf, start[4], end[4]; + u8 *buf, start[4], end[4], *flash_buffer = NULL; int rc = 0; int align_start, align_end; @@ -2985,12 +2985,19 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, memcpy(buf + align_start, data_buf, buf_size); } + if (bp->flash_info->buffered == 0) { + flash_buffer = kmalloc(264, GFP_KERNEL); + if (flash_buffer == NULL) { + rc = -ENOMEM; + goto nvram_write_end; + } + } + written = 0; while ((written < len32) && (rc == 0)) { u32 page_start, page_end, data_start, data_end; u32 addr, cmd_flags; int i; - u8 flash_buffer[264]; /* Find the page_start addr */ page_start = offset32 + written; @@ -3109,6 +3116,9 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, } nvram_write_end: + if (bp->flash_info->buffered == 0) + kfree(flash_buffer); + if (align_start || align_end) kfree(buf); return rc; |