diff options
author | Tomas Henzl <thenzl@redhat.com> | 2014-07-30 10:40:51 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-08-01 08:16:40 -0400 |
commit | 5bd355ee3b0191c6846918b049b3940182bec1cb (patch) | |
tree | 2665003f95df9bd30bec4dcfd71ed11f7444749e /drivers/scsi/pm8001 | |
parent | f5a7b5252f8a1755d065f07d9fc7752a6605743b (diff) |
pm8001: Fix erratic calculation in update_flash
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>
Diffstat (limited to 'drivers/scsi/pm8001')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_ctl.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index d3a08aea0948..e9b0921e9450 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c | |||
@@ -581,11 +581,8 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha) | |||
581 | partitionSizeTmp = | 581 | partitionSizeTmp = |
582 | *(u32 *)((u8 *)&image_hdr->image_length + sizeRead); | 582 | *(u32 *)((u8 *)&image_hdr->image_length + sizeRead); |
583 | partitionSize = be32_to_cpu(partitionSizeTmp); | 583 | partitionSize = be32_to_cpu(partitionSizeTmp); |
584 | loopcount = (partitionSize + HEADER_LEN)/IOCTL_BUF_SIZE; | 584 | loopcount = DIV_ROUND_UP(partitionSize + HEADER_LEN, |
585 | if (loopcount % IOCTL_BUF_SIZE) | 585 | IOCTL_BUF_SIZE); |
586 | loopcount++; | ||
587 | if (loopcount == 0) | ||
588 | loopcount++; | ||
589 | for (loopNumber = 0; loopNumber < loopcount; loopNumber++) { | 586 | for (loopNumber = 0; loopNumber < loopcount; loopNumber++) { |
590 | payload = (struct pm8001_ioctl_payload *)ioctlbuffer; | 587 | payload = (struct pm8001_ioctl_payload *)ioctlbuffer; |
591 | payload->length = 1024*16; | 588 | payload->length = 1024*16; |