Skip to contentSkip to conversation

memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe

PATCH Applied Nathan Chancellor 3 participants 3 messages Nov 19, 2020 – Nov 23, 2020

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

PATCH 1/1 memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe

Clang warns:

drivers/memory/tegra/tegra30-emc.c:1275:15: warning: variable 'np' is uninitialized when used here [-Wuninitialized]

                of_node_put(np);
                            ^~
drivers/memory/tegra/tegra30-emc.c:1269:24: note: initialize the
variable 'np' to silence this warning
        struct device_node *np;
                              ^
                               = NULL

1 warning generated.

There does not need to be an of_node_put call in this error handling block after the shuffling of the np assignment. Remove it so there is no use of uninitialized memory.

Fixes 5e00fd90183a ("memory: tegra30-emc: Continue probing if timings are missing in device-tree")
---
 drivers/memory/tegra/tegra30-emc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/memory/tegra/tegra30-emc.c +1 -3
index 3488786da03b..93f9002d32ad 100644
@@ -1271,10 +1271,8 @@ static int tegra_emc_probe(struct platform_device *pdev)
 	int err;
 
 	emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL);
-	if (!emc) {
-		of_node_put(np);
+	if (!emc)
 		return -ENOMEM;
-	}
 
 	emc->mc = devm_tegra_memory_controller_get(&pdev->dev);
 	if (IS_ERR(emc->mc))

base-commit: 5e00fd90183ab0103b9f403ce73cb8407ebeb145

Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw

19.11.2020 22:52, Nathan Chancellor пишет:

Quoted 41 lines

Clang warns:

drivers/memory/tegra/tegra30-emc.c:1275:15: warning: variable 'np' is uninitialized when used here [-Wuninitialized]

                of_node_put(np);
                            ^~
drivers/memory/tegra/tegra30-emc.c:1269:24: note: initialize the
variable 'np' to silence this warning
        struct device_node *np;
                              ^
                               = NULL

1 warning generated.

There does not need to be an of_node_put call in this error handling block after the shuffling of the np assignment. Remove it so there is no use of uninitialized memory.

Fixes 5e00fd90183a ("memory: tegra30-emc: Continue probing if timings are missing in device-tree")
---
 drivers/memory/tegra/tegra30-emc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/memory/tegra/tegra30-emc.c +1 -3
index 3488786da03b..93f9002d32ad 100644
@@ -1271,10 +1271,8 @@ static int tegra_emc_probe(struct platform_device *pdev)
 	int err;
 
 	emc = devm_kzalloc(&pdev->dev, sizeof(*emc), GFP_KERNEL);
-	if (!emc) {
-		of_node_put(np);
+	if (!emc)
 		return -ENOMEM;
-	}
 
 	emc->mc = devm_tegra_memory_controller_get(&pdev->dev);
 	if (IS_ERR(emc->mc))
Quoted 2 lines

base-commit: 5e00fd90183ab0103b9f403ce73cb8407ebeb145

maintainer Applied
#2 lore raw
In reply to Nathan Chancellor
Quoted 17 lines · Nathan Chancellor

Clang warns:

drivers/memory/tegra/tegra30-emc.c:1275:15: warning: variable 'np' is uninitialized when used here [-Wuninitialized]

                of_node_put(np);
                            ^~
drivers/memory/tegra/tegra30-emc.c:1269:24: note: initialize the
variable 'np' to silence this warning
        struct device_node *np;
                              ^
                               = NULL

1 warning generated.

There does not need to be an of_node_put call in this error handling block after the shuffling of the np assignment. Remove it so there is no use of uninitialized memory.

Quoted 6 lines
Fixes 5e00fd90183a ("memory: tegra30-emc: Continue probing if timings are missing in device-tree")
---
 drivers/memory/tegra/tegra30-emc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Thanks, applied.

Best regards,
Krzysztof