Skip to content

Commit 104831a

Browse files
tobluxgregkh
authored andcommitted
hpet: Optimize local variable data type in hpet_alloc()
The local variable period uses at most 32 bits and can be a u32 instead of unsigned long. The upper 32 bits are all 0 after masking and right shifting cap by HPET_COUNTER_CLK_PERIOD_SHIFT and can be discarded. Since do_div() casts the divisor to u32 anyway, changing the data type of period to u32 also removes the following Coccinelle/coccicheck warning reported by do_div.cocci: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead Signed-off-by: Thorsten Blum <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4d41a49 commit 104831a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/char/hpet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ int hpet_alloc(struct hpet_data *hdp)
808808
struct hpets *hpetp;
809809
struct hpet __iomem *hpet;
810810
static struct hpets *last;
811-
unsigned long period;
811+
u32 period;
812812
unsigned long long temp;
813813
u32 remainder;
814814

0 commit comments

Comments
 (0)