PM: hibernate: improve arithmetic division in preallocate_highmem_fraction()

do_div() does a 64-by-32 division. Use div64_u64() instead of
do_div() if the divisor is u64, to avoid truncation to 32-bit.

This change also cleans up code a tad.

Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Wen Yang 2020-01-03 23:54:58 +08:00 • committed by Rafael J. Wysocki
commit 809ed78a83