[PATCH 04/15] clk: tegra: Fix -Wtype-limits compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



divider_ux1 is checked for being smaller than 0 which can never happen
for an unsigned variable. Fix the check in a way it's currently done in
Linux

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/clk/tegra/clk-divider.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c
index cc8b85520c..8ac8c98e9f 100644
--- a/drivers/clk/tegra/clk-divider.c
+++ b/drivers/clk/tegra/clk-divider.c
@@ -46,11 +46,11 @@ static int get_div(struct tegra_clk_frac_div *divider, unsigned long rate,
 	if (flags & TEGRA_DIVIDER_INT)
 		divider_ux1 *= mul;
 
-	divider_ux1 -= mul;
-
-	if (divider_ux1 < 0)
+	if (divider_ux1 < mul)
 		return 0;
 
+	divider_ux1 -= mul;
+
 	if (divider_ux1 > get_max_div(divider))
 		return -EINVAL;
 
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux