mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
f5a7b5252f
commit
5bd355ee3b
1 changed files with 2 additions and 5 deletions
|
@ -581,11 +581,8 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha)
|
||||||
partitionSizeTmp =
|
partitionSizeTmp =
|
||||||
*(u32 *)((u8 *)&image_hdr->image_length + sizeRead);
|
*(u32 *)((u8 *)&image_hdr->image_length + sizeRead);
|
||||||
partitionSize = be32_to_cpu(partitionSizeTmp);
|
partitionSize = be32_to_cpu(partitionSizeTmp);
|
||||||
loopcount = (partitionSize + HEADER_LEN)/IOCTL_BUF_SIZE;
|
loopcount = DIV_ROUND_UP(partitionSize + HEADER_LEN,
|
||||||
if (loopcount % IOCTL_BUF_SIZE)
|
IOCTL_BUF_SIZE);
|
||||||
loopcount++;
|
|
||||||
if (loopcount == 0)
|
|
||||||
loopcount++;
|
|
||||||
for (loopNumber = 0; loopNumber < loopcount; loopNumber++) {
|
for (loopNumber = 0; loopNumber < loopcount; loopNumber++) {
|
||||||
payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
|
payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
|
||||||
payload->length = 1024*16;
|
payload->length = 1024*16;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue