qla2xxx: ISP27xx fwdump template fix insertbuf() routine.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Joe Carnuccio 2014-09-25 05:16:35 -04:00 committed by Christoph Hellwig
parent 01cb65f1bb
commit ce9b9b0858
1 changed files with 2 additions and 10 deletions

View File

@ -128,18 +128,10 @@ qla27xx_insert32(uint32_t value, void *buf, ulong *len)
static inline void static inline void
qla27xx_insertbuf(void *mem, ulong size, void *buf, ulong *len) qla27xx_insertbuf(void *mem, ulong size, void *buf, ulong *len)
{ {
ulong cnt = size;
if (buf && mem) { if (buf && mem && size) {
buf += *len; buf += *len;
while (cnt >= sizeof(uint32_t)) { memcpy(buf, mem, size);
*(__le32 *)buf = cpu_to_le32p(mem);
buf += sizeof(uint32_t);
mem += sizeof(uint32_t);
cnt -= sizeof(uint32_t);
}
if (cnt)
memcpy(buf, mem, cnt);
} }
*len += size; *len += size;
} }