]> git.ipfire.org Git - thirdparty/kernel/stable.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)
commit9f825e74d761c13b0cfaa5f65344d64ff970e252
tree27e468bb03044278cad53d29adae9076e0f536b1
parent90d617633368ab97a2c7571c6e66dad54f39228d
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: 8878b126df769831 ("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