Skip to content
Commit 8f704ef6 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller
Browse files

stmmac: fix signed 64-bit division



I link error on 32-bit ARM points to yet another arithmetic bug:

drivers/net/ethernet/stmicro/stmmac/stmmac_tc.o: In function `tc_setup_cbs':
stmmac_tc.c:(.text+0x148): undefined reference to `__aeabi_uldivmod'
stmmac_tc.c:(.text+0x1fc): undefined reference to `__aeabi_uldivmod'
stmmac_tc.c:(.text+0x308): undefined reference to `__aeabi_uldivmod'
stmmac_tc.c:(.text+0x320): undefined reference to `__aeabi_uldivmod'
stmmac_tc.c:(.text+0x33c): undefined reference to `__aeabi_uldivmod'
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.o:stmmac_tc.c:(.text+0x3a4): more undefined references to `__aeabi_uldivmod' follow

I observe that the last change to add the 'ul' prefix was incorrect,
as it did not turn the result of the multiplication into a 64-bit
expression on 32-bit architectures. Further, it seems that the
do_div() macro gets confused by the fact that we pass a signed
variable rather than unsigned into it.

This changes the code to instead use the div_s64() helper that is
meant for signed division, along with changing the constant suffix
to 'll' to actually make it a 64-bit argument everywhere, fixing
both of the issues I pointed out.

I'm not completely convinced that this makes the code correct, but
I'm fairly sure that we have two problems less than before.

Fixes: 1f705bc6 ("net: stmmac: Add support for CBS QDISC")
Fixes: c18a9c09 ("net: stmmac_tc: use 64-bit arithmetic instead of 32-bit")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4dc70d4
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment