Unverified Commit 2dc2ca90 authored by Pei Xiao's avatar Pei Xiao Committed by Stephen Boyd
Browse files

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: default avatarPei Xiao <xiaopei01@kylinos.cn>
Link: https://lore.kernel.org/r/79c7f01e29876c612e90d6d0157fb1572ca8b3fb.1752046270.git.xiaopei01@kylinos.cn


Acked-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent ba6651a7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ static int clk_periph_determine_rate(struct clk_hw *hw,
	struct tegra_clk_periph *periph = to_clk_periph(hw);
	const struct clk_ops *div_ops = periph->div_ops;
	struct clk_hw *div_hw = &periph->divider.hw;
	unsigned long rate;
	long rate;

	__clk_hw_set_clk(div_hw, hw);

@@ -59,7 +59,7 @@ static int clk_periph_determine_rate(struct clk_hw *hw,
	if (rate < 0)
		return rate;

	req->rate = rate;
	req->rate = (unsigned long)rate;
	return 0;
}