diff options
author | Stephen Warren <swarren@nvidia.com> | 2016-06-21 13:32:07 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-06-24 17:24:35 -0400 |
commit | df8b0a037394246fd591b7fac4de4541810ab1e8 (patch) | |
tree | 8631fc431dcc3446e91e62011a60f727e706ecd2 /drivers | |
parent | bd62e2419b9528292882e3b0008c507db6ae20a8 (diff) | |
download | u-boot-imx-df8b0a037394246fd591b7fac4de4541810ab1e8.zip u-boot-imx-df8b0a037394246fd591b7fac4de4541810ab1e8.tar.gz u-boot-imx-df8b0a037394246fd591b7fac4de4541810ab1e8.tar.bz2 |
clk: sandbox: don't check clk ID against 0
clk->id is unsigned, so it can't be < 0. Remove the check for that.
FWIW, this issue was introduced when the clock API converted e.g.
clk_get_rate()'s clock ID parameter from an int to an unsigned long
(with a struct clk), without removing this check.
Fixes: 135aa9500264 ("clk: convert API to match reset/mailbox style")
Reported-by: Coverity Scan
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/clk/clk_sandbox.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c index c6bd7c6..ef58503 100644 --- a/drivers/clk/clk_sandbox.c +++ b/drivers/clk/clk_sandbox.c @@ -19,7 +19,7 @@ static ulong sandbox_clk_get_rate(struct clk *clk) { struct sandbox_clk_priv *priv = dev_get_priv(clk->dev); - if (clk->id < 0 || clk->id >= SANDBOX_CLK_ID_COUNT) + if (clk->id >= SANDBOX_CLK_ID_COUNT) return -EINVAL; return priv->rate[clk->id]; @@ -30,7 +30,7 @@ static ulong sandbox_clk_set_rate(struct clk *clk, ulong rate) struct sandbox_clk_priv *priv = dev_get_priv(clk->dev); ulong old_rate; - if (clk->id < 0 || clk->id >= SANDBOX_CLK_ID_COUNT) + if (clk->id >= SANDBOX_CLK_ID_COUNT) return -EINVAL; if (!rate) @@ -46,7 +46,7 @@ static int sandbox_clk_enable(struct clk *clk) { struct sandbox_clk_priv *priv = dev_get_priv(clk->dev); - if (clk->id < 0 || clk->id >= SANDBOX_CLK_ID_COUNT) + if (clk->id >= SANDBOX_CLK_ID_COUNT) return -EINVAL; priv->enabled[clk->id] = true; @@ -58,7 +58,7 @@ static int sandbox_clk_disable(struct clk *clk) { struct sandbox_clk_priv *priv = dev_get_priv(clk->dev); - if (clk->id < 0 || clk->id >= SANDBOX_CLK_ID_COUNT) + if (clk->id >= SANDBOX_CLK_ID_COUNT) return -EINVAL; priv->enabled[clk->id] = false; |