diff options
author | Dan Gopstein <dgopstein@nyu.edu> | 2017-12-25 22:16:14 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-03-06 10:08:17 +0100 |
commit | 7aa92c4229fefff0cab6930cf977f4a0e3e606d8 (patch) | |
tree | 31f5e43b03e4837db5eff1dc04ed477d2bfdaf43 /drivers/media/dvb-frontends/dib7000p.c | |
parent | media: dvb-frontend/mxl5xx: add support for physical layer scrambling (diff) | |
download | linux-7aa92c4229fefff0cab6930cf977f4a0e3e606d8.tar.xz linux-7aa92c4229fefff0cab6930cf977f4a0e3e606d8.zip |
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>
Diffstat (limited to 'drivers/media/dvb-frontends/dib7000p.c')
-rw-r--r-- | drivers/media/dvb-frontends/dib7000p.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c index 90ace707a80d..902af482448e 100644 --- a/drivers/media/dvb-frontends/dib7000p.c +++ b/drivers/media/dvb-frontends/dib7000p.c @@ -809,7 +809,7 @@ static int dib7000p_set_dds(struct dib7000p_state *state, s32 offset_khz) { u32 internal = dib7000p_get_internal_freq(state); s32 unit_khz_dds_val; - u32 abs_offset_khz = ABS(offset_khz); + u32 abs_offset_khz = abs(offset_khz); u32 dds = state->cfg.bw->ifreq & 0x1ffffff; u8 invert = !!(state->cfg.bw->ifreq & (1 << 25)); if (internal == 0) { |