Skip to content

Commit 2dc2ca9

Browse files
Pei Xiaobebarino
authored andcommitted
clk: tegra: periph: Fix error handling and resolve unsigned compare warning
./drivers/clk/tegra/clk-periph.c:59:5-9: WARNING: Unsigned expression compared with zero: rate < 0 The unsigned long 'rate' variable caused: - Incorrect handling of negative errors - Compile warning: "Unsigned expression compared with zero" Fix by changing to long type and adding req->rate cast. Signed-off-by: Pei Xiao <[email protected]> Link: https://lore.kernel.org/r/79c7f01e29876c612e90d6d0157fb1572ca8b3fb.1752046270.git.xiaopei01@kylinos.cn Acked-by: Thierry Reding <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent ba6651a commit 2dc2ca9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/clk/tegra/clk-periph.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ static int clk_periph_determine_rate(struct clk_hw *hw,
5151
struct tegra_clk_periph *periph = to_clk_periph(hw);
5252
const struct clk_ops *div_ops = periph->div_ops;
5353
struct clk_hw *div_hw = &periph->divider.hw;
54-
unsigned long rate;
54+
long rate;
5555

5656
__clk_hw_set_clk(div_hw, hw);
5757

5858
rate = div_ops->round_rate(div_hw, req->rate, &req->best_parent_rate);
5959
if (rate < 0)
6060
return rate;
6161

62-
req->rate = rate;
62+
req->rate = (unsigned long)rate;
6363
return 0;
6464
}
6565

0 commit comments

Comments
 (0)