There are three errors in div64.h caused by commit c21004cd5b4cb7d479514 ("MIPS: Rewrite <asm/div64.h> to work with gcc 4.4.0."): 1, Only 32bit kernel need __div64_32(), but the above commit makes it depend on 64bit kernel by mistake. 2, asm-generic/div64.h should be included after __div64_32() definition. 3, __n should be initialized as *n before use (and "*__n >> 32" should be "__n >> 32") in __div64_32() definition. Fixes: c21004cd5b4cb7d479514 ("MIPS: Rewrite <asm/div64.h> to work with gcc 4.4.0.") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx> --- arch/mips/include/asm/div64.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/mips/include/asm/div64.h b/arch/mips/include/asm/div64.h index dc5ea5736440..3be2318f8e0e 100644 --- a/arch/mips/include/asm/div64.h +++ b/arch/mips/include/asm/div64.h @@ -9,9 +9,7 @@ #ifndef __ASM_DIV64_H #define __ASM_DIV64_H -#include <asm-generic/div64.h> - -#if BITS_PER_LONG == 64 +#if BITS_PER_LONG == 32 #include <linux/types.h> @@ -24,9 +22,9 @@ unsigned long __cf, __tmp, __tmp2, __i; \ unsigned long __quot32, __mod32; \ unsigned long __high, __low; \ - unsigned long long __n; \ + unsigned long long __n = *n; \ \ - __high = *__n >> 32; \ + __high = __n >> 32; \ __low = __n; \ __asm__( \ " .set push \n" \ @@ -65,4 +63,6 @@ #endif /* BITS_PER_LONG == 64 */ +#include <asm-generic/div64.h> + #endif /* __ASM_DIV64_H */ -- 2.27.0