Skip to contentSkip to conversation

clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver

PATCH Superseded Miaoqian Lin 3 participants 4 messages Jan 7, 2022 – Feb 25, 2022

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

PATCH 1/1 clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver

The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

---
 drivers/clk/tegra/clk-tegra124-emc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-tegra124-emc.c +1 -0
index 74c1d894cca8..219c80653dbd 100644
@@ -198,6 +198,7 @@ static struct tegra_emc *emc_ensure_emc_driver(struct tegra_clk_emc *tegra)
 
 	tegra->emc = platform_get_drvdata(pdev);
 	if (!tegra->emc) {
+		put_device(&pdev->dev);
 		pr_err("%s: cannot find EMC driver\n", __func__);
 		return NULL;
 	}
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Quoting Miaoqian Lin (2022-01-07 00:24:36)

Quoted 5 lines

The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Please send the mail To: somebody

Also, please add a Fixes: tag.

#2 lore raw

PATCH v2 1/1 clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver

The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Fixes 2db04f16b589 ("clk: tegra: Add EMC clock driver")

---
Changes in v2:
- add fixes tag.

---
 drivers/clk/tegra/clk-tegra124-emc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-tegra124-emc.c +1 -0
index 74c1d894cca8..219c80653dbd 100644
@@ -198,6 +198,7 @@ static struct tegra_emc *emc_ensure_emc_driver(struct tegra_clk_emc *tegra)
 
 	tegra->emc = platform_get_drvdata(pdev);
 	if (!tegra->emc) {
+		put_device(&pdev->dev);
 		pr_err("%s: cannot find EMC driver\n", __func__);
 		return NULL;
 	}
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#3 lore raw
Quoted 4 lines · Miaoqian Lin

The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Quoted 8 lines
Fixes 2db04f16b589 ("clk: tegra: Add EMC clock driver")

---
Changes in v2:
- add fixes tag.

---
 drivers/clk/tegra/clk-tegra124-emc.c | 1 +
 1 file changed, 1 insertion(+)

Stephen, Mike,

I don't have anything else for clock tree this cycle, so perhaps best for you guys to pick this up directly: