soc: mediatek: Fix off-by-one checking for rate_spi
PATCH 1/1 soc: mediatek: Fix off-by-one checking for rate_spi
If rate_spi is 26000000, current code set ck_mhz to 18 rather than 26. Fix the off-by-one checking for rate_spi.
--- drivers/soc/mediatek/mtk-pmic-wrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/mediatek/mtk-pmic-wrap.c +2 -2
@@ -568,9 +568,9 @@ static int pwrap_init_reg_clock(struct pmic_wrapper *wrp) rate_spi =clk_get_rate (wrp->clk_spi); -if (rate_spi >26000000 ) +if (rate_spi >=26000000 ) ck_mhz =26 ; -else if (rate_spi >18000000 ) +else if (rate_spi >=18000000 ) ck_mhz =18 ;else ck_mhz =0 ;
Signature · 1 line
2.1.0
PATCH 1/1 soc: mediatek: Fix off-by-one checking for rate_spi
Quoted 4 lines · Axel Lin
If
rate_spiis 26000000, current code setck_mhzto 18 rather than 26. Fix the off-by-one checking forrate_spi.Signed-off-by Axel Lin <[email protected]>
Quoted 26 lines
--- drivers/soc/mediatek/mtk-pmic-wrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/soc/mediatek/mtk-pmic-wrap.c +2
-2@@ -568,9 +568,9 @@ static int pwrap_init_reg_clock(struct pmic_wrapper *wrp) rate_spi =clk_get_rate (wrp->clk_spi); -if (rate_spi >26000000 ) +if (rate_spi >=26000000 ) ck_mhz =26 ; -else if (rate_spi >18000000 ) +else if (rate_spi >=18000000 ) ck_mhz =18 ;else ck_mhz =0 ;Signature · 1 line
2.1.0
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Matthias Brugger
maintainerPATCH 1/1 soc: mediatek: Fix off-by-one checking for rate_spi
Hi Sascha,
2015-04-21 12:59 GMT+02:00 Sascha Hauer <[email protected]>:
Quoted 8 lines · Axel Lin
Quoted 4 lines
If
rate_spiis 26000000, current code setck_mhzto 18 rather than 26. Fix the off-by-one checking forrate_spi.Signed-off-by Axel Lin <[email protected]>Acked-by Sascha Hauer <[email protected]>
Can you please explain why you think this is a bug? Please see my concerns here [1].
Best regards,
Matthias
[1] http://lists.infradead.org/pipermail/linux-mediatek/2015-April/000419.html