]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: Fix return type of __DIVIDE() when called with 32-bit
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 14 May 2018 10:49:37 +0000 (12:49 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Tue, 15 May 2018 12:40:34 +0000 (14:40 +0200)
commitf74f05298636226fabe18f3ff4d8665e45a99756
tree27e468bb03044278cad53d29adae9076e0f536b1
parente1993ec993f03f8f46a19865c69efcecb5e247d2
mtd: rawnand: Fix return type of __DIVIDE() when called with 32-bit

The __DIVIDE() macro checks whether it is called with a 32-bit or 64-bit
dividend, to select the appropriate divide-and-round-up routine.
As the check uses the ternary operator, the result will always be
promoted to a type that can hold both results, i.e. unsigned long long.

When using this result in a division on a 32-bit system, this may lead
to link errors like:

    ERROR: "__udivdi3" [drivers/mtd/nand/raw/nand.ko] undefined!

Fix this by casting the result of the division to the type of the
dividend.

Fixes: 9a59b75e09eef7c9 ("mtd: nand: add ->exec_op() implementation")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
include/linux/mtd/rawnand.h