From: Peter Rosin Date: Wed, 16 Mar 2016 12:14:13 +0000 (-0300) Subject: [media] m88ds3103: fix undefined division X-Git-Tag: v4.7~34^2~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ecb7b0183a89613c154d1bea48b494907efbf8f9;p=platform%2Fkernel%2Flinux-exynos.git [media] m88ds3103: fix undefined division s32tmp in the below code may be negative, and dev->mclk_khz is an unsigned type. s32tmp = 0x10000 * (tuner_frequency - c->frequency); s32tmp = DIV_ROUND_CLOSEST(s32tmp, dev->mclk_khz); This is undefined, as DIV_ROUND_CLOSEST is undefined for negative dividends when the divisor is of unsigned type. So, change mclk_khz to be signed (s32). Signed-off-by: Peter Rosin Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb-frontends/m88ds3103_priv.h b/drivers/media/dvb-frontends/m88ds3103_priv.h index eee8c22..651e005 100644 --- a/drivers/media/dvb-frontends/m88ds3103_priv.h +++ b/drivers/media/dvb-frontends/m88ds3103_priv.h @@ -46,7 +46,7 @@ struct m88ds3103_dev { /* auto detect chip id to do different config */ u8 chip_id; /* main mclk is calculated for M88RS6000 dynamically */ - u32 mclk_khz; + s32 mclk_khz; u64 post_bit_error; u64 post_bit_count; };