Skip to content

Commit

Permalink
pm8001: Fix erratic calculation in update_flash
Browse files Browse the repository at this point in the history
The loopcount is calculated by using some weird magic. Use instead a boring
macro.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Tomas Henzl authored and Christoph Hellwig committed Aug 1, 2014
1 parent f5a7b52 commit 5bd355e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/scsi/pm8001/pm8001_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,8 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)
partitionSizeTmp =
*(u32 *)((u8 *)&image_hdr->image_length + sizeRead);
partitionSize = be32_to_cpu(partitionSizeTmp);
loopcount = (partitionSize + HEADER_LEN)/IOCTL_BUF_SIZE;
if (loopcount % IOCTL_BUF_SIZE)
loopcount++;
if (loopcount == 0)
loopcount++;
loopcount = DIV_ROUND_UP(partitionSize + HEADER_LEN,
IOCTL_BUF_SIZE);
for (loopNumber = 0; loopNumber < loopcount; loopNumber++) {
payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
payload->length = 1024*16;
Expand Down

0 comments on commit 5bd355e

Please sign in to comment.