2023-06-14 01:49:48

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH] clk: sprd: composite: Fix unsigned comparison with less than zero

The rate is defined as unsigned long type, if(rate<0) is invalid, modify
to int type.

drivers/clk/sprd/composite.c:20 sprd_comp_determine_rate() warn: unsigned 'rate' is never less than zero.

Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5520
Signed-off-by: Jiapeng Chong <[email protected]>
---
drivers/clk/sprd/composite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
index d3a852720c07..1c0390e8342e 100644
--- a/drivers/clk/sprd/composite.c
+++ b/drivers/clk/sprd/composite.c
@@ -13,7 +13,7 @@ static int sprd_comp_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct sprd_comp *cc = hw_to_sprd_comp(hw);
- unsigned long rate;
+ int rate;

rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
req->rate, &req->best_parent_rate);
--
2.20.1.7.g153144c