clk: sprd: composite: Fix unsigned comparison with less than zero
Subsystems (5)
PATCH 1/3 clk: sprd: composite: Fix unsigned comparison with less than zero
The return value of the sprd_div_helper_round_rate() is long. However, the return value is being assigned to an unsigned long variable 'rate', so making 'rate' to long.
silence the warning:
./drivers/clk/sprd/composite.c:20:5-9: WARNING: Unsigned expression compared with zero: rate < 0
--- drivers/clk/sprd/composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sprd/composite.c +1 -1
@@ -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; +long rate; rate =sprd_div_helper_round_rate (&cc->common, &cc->div, req->rate, &req->best_parent_rate);
Signature · 1 line
2.20.1.7.g153144c
PATCH 2/3 clk: stm32: core: Fix unsigned comparison with less than zero
The return value of the divider_ro_round_rate() is long. However, the return value is being assigned to an unsigned long variable 'rate', so making 'rate' to long.
silence the warnings:
./drivers/clk/stm32/clk-stm32-core.c:451:6-10: WARNING: Unsigned expression compared with zero: rate < 0 ./drivers/clk/stm32/clk-stm32-core.c:461:5-9: WARNING: Unsigned expression compared with zero: rate < 0
--- drivers/clk/stm32/clk-stm32-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/stm32/clk-stm32-core.c +1 -1
@@ -431,7 +431,7 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw, {struct clk_stm32_composite *composite =to_clk_stm32_composite (hw);const struct stm32_div_cfg *divider; -unsigned long rate; +long rate;if (composite->div_id ==NO_STM32_DIV )return 0 ;
Signature · 1 line
2.20.1.7.g153144c
Stephen Boyd
maintainerRe: [PATCH -next 2/3] clk: stm32: core: Fix unsigned comparison with less than zero
Quoting Yang Li (2023-06-13 18:29:12)
Quoted 20 lines
The return value of the
divider_ro_round_rate()is long. However, the return value is being assigned to an unsigned long variable 'rate', so making 'rate' to long.silence the warnings:
./drivers/clk/stm32/clk-stm32-core.c:451:6-10: WARNING: Unsigned expression compared with zero: rate < 0 ./drivers/clk/stm32/clk-stm32-core.c:461:5-9: WARNING: Unsigned expression compared with zero: rate < 0Reported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>--- drivers/clk/stm32/clk-stm32-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/stm32/clk-stm32-core.c +0
-0
drivers/clk/stm32/clk-stm32-core.c static int clk_stm32_composite_determine_rate(struct clk_hw *hw, · line 435
Quoted 6 lines
drivers/clk/stm32/clk-stm32-core.c +1
-1@@ -431,7 +431,7 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw, {struct clk_stm32_composite *composite =to_clk_stm32_composite (hw);const struct stm32_div_cfg *divider; -unsigned long rate; +long rate;
Instead of this can you convert this code to use divider_ro_determine_rate() and divider_determine_rate()?
PATCH 3/3 clk: tegra: Fix unsigned comparison with less than zero
In reply to Yang LiThe return value of the round_rate() is long. However, the return value is being assigned to an unsigned long variable 'rate', so making 'rate' to long.
silence the warnings:
./drivers/clk/tegra/clk-periph.c:59:5-9: WARNING: Unsigned expression compared with zero: rate < 0 ./drivers/clk/tegra/clk-super.c:156:5-9: WARNING: Unsigned expression compared with zero: rate < 0
--- drivers/clk/tegra/clk-periph.c | 2 +- drivers/clk/tegra/clk-super.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-periph.c +1 -1
@@ -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);
drivers/clk/tegra/clk-super.c +1 -1
@@ -147,7 +147,7 @@ static int clk_super_determine_rate(struct clk_hw *hw, {struct tegra_clk_super_mux *super =to_clk_super_mux (hw);struct clk_hw *div_hw = &super->frac_div.hw; -unsigned long rate; +long rate;__clk_hw_set_clk (div_hw, hw);
Signature · 1 line
2.20.1.7.g153144c
Stephen Boyd
maintainerRe: [PATCH -next 3/3] clk: tegra: Fix unsigned comparison with less than zero
Quoting Yang Li (2023-06-13 18:29:13)
Quoted 8 lines
The return value of the
round_rate()is long. However, the return value is being assigned to an unsigned long variable 'rate', so making 'rate' to long.silence the warnings:
./drivers/clk/tegra/clk-periph.c:59:5-9: WARNING: Unsigned expression compared with zero: rate < 0 ./drivers/clk/tegra/clk-super.c:156:5-9: WARNING: Unsigned expression compared with zero: rate < 0
Quoted 7 lines
Reported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>--- drivers/clk/tegra/clk-periph.c | 2 +- drivers/clk/tegra/clk-super.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Instead of this can you implement determine_rate() for div_ops?