Skip to contentSkip to conversation

clk: tegra: Drop !provider check in tegra210_clk_emc_set_rate()

PATCH Applied Stephen Boyd 2 participants 3 messages Sep 22, 2020 – Sep 23, 2020

Subsystems (3)
lore
Share & tools
lore

Stephen Boyd

author maintainer
#0 lore raw

PATCH 1/1 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")
---
 drivers/clk/tegra/clk-tegra210-emc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra210-emc.c +1 -1
index 352a2c3fc374..971c919b2994 100644
@@ -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

Signature · 1 line
https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Stephen Boyd

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)

Quoted 7 lines
Cc Joseph Lo <[email protected]>
Cc Thierry Reding <[email protected]>
Fixes 0ac65fc946d3 ("clk: tegra: Implement Tegra210 EMC clock")
---
 drivers/clk/tegra/clk-tegra210-emc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author maintainer Applied
#2 lore raw
In reply to Stephen Boyd

Quoting Stephen Boyd (2020-09-22 12:16:41)

Quoted 5 lines

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

Found with smatch

Quoted 7 lines

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")

---

Applied to clk-next