]> git.baikalelectronics.ru Git - kernel.git/commit
media: ABS macro parameter parenthesization
authorDan Gopstein <dgopstein@nyu.edu>
Mon, 25 Dec 2017 21:16:14 +0000 (16:16 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 6 Mar 2018 09:08:17 +0000 (04:08 -0500)
commit2d8a7e36e3f8a84f83801d8546f1b3f642549d2c
tree31f5e43b03e4837db5eff1dc04ed477d2bfdaf43
parentbbffd6b961a727c2fe6e6c77b31a735eac4cbbcb
media: ABS macro parameter parenthesization

Replace usages of the locally defined ABS() macro with calls to the
canonical abs() from kernel.h and remove the old definitions of ABS()

This change was originally motivated by two local definitions of the
ABS (absolute value) macro that fail to parenthesize their parameter
properly. This can lead to a bad expansion for low-precedence
expression arguments.

For example: ABS(1-2) currently expands to ((1-2) < 0 ? (-1-2) : (1-2))
which evaluates to -3. But the correct expansion would be
((1-2) < 0 ? -(1-2) : (1-2)) which evaluates to 1.

Signed-off-by: Dan Gopstein <dgopstein@nyu.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/dvb-frontends/dib0090.c
drivers/media/dvb-frontends/dib7000p.c
drivers/media/dvb-frontends/dib8000.c
drivers/media/dvb-frontends/dibx000_common.h
drivers/media/dvb-frontends/mb86a16.c
drivers/media/dvb-frontends/stv0367_priv.h
drivers/media/dvb-frontends/stv0900_priv.h
drivers/media/dvb-frontends/stv0900_sw.c