* [PATCH] memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe
@ 2020-11-19 19:52 Nathan Chancellor
2020-11-19 20:00 ` Dmitry Osipenko
2020-11-23 16:30 ` Krzysztof Kozlowski
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2020-11-19 19:52 UTC (permalink / raw)
To: Krzysztof Kozlowski, Dmitry Osipenko
Cc: Thierry Reding, Jonathan Hunter, Nick Desaulniers, linux-kernel,
linux-tegra, clang-built-linux, 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.
Fixes: 5e00fd90183a ("memory: tegra30-emc: Continue probing if timings are missing in device-tree")
Link: https://github.com/ClangBuiltLinux/linux/issues/1203
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/memory/tegra/tegra30-emc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c
index 3488786da03b..93f9002d32ad 100644
--- a/drivers/memory/tegra/tegra30-emc.c
+++ b/drivers/memory/tegra/tegra30-emc.c
@@ -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
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe
2020-11-19 19:52 [PATCH] memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe Nathan Chancellor
@ 2020-11-19 20:00 ` Dmitry Osipenko
2020-11-23 16:30 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2020-11-19 20:00 UTC (permalink / raw)
To: Nathan Chancellor, Krzysztof Kozlowski
Cc: Thierry Reding, Jonathan Hunter, Nick Desaulniers, linux-kernel,
linux-tegra, clang-built-linux
19.11.2020 22:52, 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.
>
> Fixes: 5e00fd90183a ("memory: tegra30-emc: Continue probing if timings are missing in device-tree")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1203
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/memory/tegra/tegra30-emc.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c
> index 3488786da03b..93f9002d32ad 100644
> --- a/drivers/memory/tegra/tegra30-emc.c
> +++ b/drivers/memory/tegra/tegra30-emc.c
> @@ -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
>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe
2020-11-19 19:52 [PATCH] memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe Nathan Chancellor
2020-11-19 20:00 ` Dmitry Osipenko
@ 2020-11-23 16:30 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-11-23 16:30 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Dmitry Osipenko, Thierry Reding, Jonathan Hunter,
Nick Desaulniers, linux-kernel, linux-tegra, clang-built-linux
On Thu, Nov 19, 2020 at 12:52:44PM -0700, Nathan Chancellor wrote:
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1203
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/memory/tegra/tegra30-emc.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Thanks, applied.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-23 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 19:52 [PATCH] memory: tegra30-emc: Remove unnecessary of_node_put in tegra_emc_probe Nathan Chancellor
2020-11-19 20:00 ` Dmitry Osipenko
2020-11-23 16:30 ` Krzysztof Kozlowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.