2020-09-22 19:18:08

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH] clk: tegra: Drop !provider check in tegra210_clk_emc_set_rate()

The provider variable is already dereferenced earlier in this function.
Drop the check for NULL as it is impossible.

Found with smatch

drivers/clk/tegra/clk-tegra210-emc.c:131 tegra210_clk_emc_set_rate() warn: variable dereferenced before check 'provider' (see line 124)

Cc: Joseph Lo <[email protected]>
Cc: Thierry Reding <[email protected]>
Fixes: 0ac65fc946d3 ("clk: tegra: Implement Tegra210 EMC clock")
Signed-off-by: Stephen Boyd <[email protected]>
---
drivers/clk/tegra/clk-tegra210-emc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-tegra210-emc.c b/drivers/clk/tegra/clk-tegra210-emc.c
index 352a2c3fc374..971c919b2994 100644
--- a/drivers/clk/tegra/clk-tegra210-emc.c
+++ b/drivers/clk/tegra/clk-tegra210-emc.c
@@ -126,7 +126,7 @@ static int tegra210_clk_emc_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned int i;
int err;

- if (!provider || !provider->configs || provider->num_configs == 0)
+ if (!provider->configs || provider->num_configs == 0)
return -EINVAL;

for (i = 0; i < provider->num_configs; i++) {

base-commit: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
--
https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/


2020-09-23 08:27:23

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] clk: tegra: Drop !provider check in tegra210_clk_emc_set_rate()

On Tue, Sep 22, 2020 at 12:16:41PM -0700, Stephen Boyd wrote:
> The provider variable is already dereferenced earlier in this function.
> Drop the check for NULL as it is impossible.
>
> Found with smatch
>
> drivers/clk/tegra/clk-tegra210-emc.c:131 tegra210_clk_emc_set_rate() warn: variable dereferenced before check 'provider' (see line 124)
>
> Cc: Joseph Lo <[email protected]>
> Cc: Thierry Reding <[email protected]>
> Fixes: 0ac65fc946d3 ("clk: tegra: Implement Tegra210 EMC clock")
> Signed-off-by: Stephen Boyd <[email protected]>
> ---
> drivers/clk/tegra/clk-tegra210-emc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (711.00 B)
signature.asc (849.00 B)
Download all attachments

2020-09-24 00:01:17

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] clk: tegra: Drop !provider check in tegra210_clk_emc_set_rate()

Quoting Stephen Boyd (2020-09-22 12:16:41)
> The provider variable is already dereferenced earlier in this function.
> Drop the check for NULL as it is impossible.
>
> Found with smatch
>
> drivers/clk/tegra/clk-tegra210-emc.c:131 tegra210_clk_emc_set_rate() warn: variable dereferenced before check 'provider' (see line 124)
>
> Cc: Joseph Lo <[email protected]>
> Cc: Thierry Reding <[email protected]>
> Fixes: 0ac65fc946d3 ("clk: tegra: Implement Tegra210 EMC clock")
> Signed-off-by: Stephen Boyd <[email protected]>
> ---

Applied to clk-next