Skip to contentSkip to conversation

clk: tegra: dfll: Fix a potential Oop in remove()

PATCH Applied Dan Carpenter 2 participants 2 messages Dec 18, 2018 – Jan 9, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: tegra: dfll: Fix a potential Oop in remove()

If tegra_dfll_unregister() fails then "soc" is an error pointer. We should just return instead of dereferencing it.

Fixes 1752c9ee23fb ("clk: tegra: dfll: Fix drvdata overwriting issue")
---
 drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra124-dfll-fcpu.c +3 -1
index 269d3595758b..edc31bb56674 100644
@@ -133,9 +133,11 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev)
 	struct tegra_dfll_soc_data *soc;
 
 	soc = tegra_dfll_unregister(pdev);
-	if (IS_ERR(soc))
+	if (IS_ERR(soc)) {
 		dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n",
 			PTR_ERR(soc));
+		return PTR_ERR(soc);
+	}
 
 	tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq);
 
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw

Quoting Dan Carpenter (2018-12-18 00:22:41)

Quoted 6 lines

If tegra_dfll_unregister() fails then "soc" is an error pointer. We should just return instead of dereferencing it.

Fixes 1752c9ee23fb ("clk: tegra: dfll: Fix drvdata overwriting issue")

---

Applied to clk-fixes