Skip to content

Commit

Permalink
mptfusion: simplify rounding
Browse files Browse the repository at this point in the history
Rounding up to a multiple of 4 should be done using the ALIGN
macro. As a bonus, this also makes the generated code smaller.

In GetIocFacts(), sz is assigned to a few lines below without being
read in the meantime, so it is ok that it doesn't end up with the same
value as facts->FWImageSize.

Signed-off-by: Rasmus Villemoes <[email protected]>
Reviewed-by: Joe Lawrence <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
  • Loading branch information
Villemoes authored and Christoph Hellwig committed Sep 16, 2014
1 parent 84e32a0 commit f6e495a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 1 addition & 6 deletions drivers/message/fusion/mptbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -3172,12 +3172,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
facts->FWImageSize = le32_to_cpu(facts->FWImageSize);
}

sz = facts->FWImageSize;
if ( sz & 0x01 )
sz += 1;
if ( sz & 0x02 )
sz += 2;
facts->FWImageSize = sz;
facts->FWImageSize = ALIGN(facts->FWImageSize, 4);

if (!facts->RequestFrameSize) {
/* Something is wrong! */
Expand Down
7 changes: 1 addition & 6 deletions drivers/message/fusion/mptctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1741,12 +1741,7 @@ mptctl_replace_fw (unsigned long arg)

/* Allocate memory for the new FW image
*/
newFwSize = karg.newImageSize;

if (newFwSize & 0x01)
newFwSize += 1;
if (newFwSize & 0x02)
newFwSize += 2;
newFwSize = ALIGN(karg.newImageSize, 4);

mpt_alloc_fw_memory(ioc, newFwSize);
if (ioc->cached_fw == NULL)
Expand Down

0 comments on commit f6e495a

Please sign in to comment.