Re: [PATCH 2/2] firmware: tegra: bpmp: use scoped device node handling to simplify error paths

From: Krzysztof Kozlowski
Date: Tue Oct 01 2024 - 16:34:37 EST


On 16/08/2024 15:57, Krzysztof Kozlowski wrote:
> Obtain the device node reference with scoped/cleanup.h to reduce error
> handling and make the code a bit simpler.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> ---
> drivers/firmware/tegra/bpmp.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
> index c3a1dc344961..2edc3838538e 100644
> --- a/drivers/firmware/tegra/bpmp.c
> +++ b/drivers/firmware/tegra/bpmp.c
> @@ -3,6 +3,7 @@
> * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
> */
>
> +#include <linux/cleanup.h>
> #include <linux/clk/tegra.h>
> #include <linux/genalloc.h>
> #include <linux/mailbox_client.h>
> @@ -36,27 +37,22 @@ struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
> {
> struct platform_device *pdev;
> struct tegra_bpmp *bpmp;
> - struct device_node *np;
>
> - np = of_parse_phandle(dev->of_node, "nvidia,bpmp", 0);
> + struct device_node *np __free(device_node) = of_parse_phandle(dev->of_node,
> + "nvidia,bpmp", 0);

Uhhh, this is very strange.

Above is correct code which I sent.

But look what was applied:

struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
{
+ struct device_node *np __free(device_node);

That's very different.

See commit 8812b8689ee6 ("firmware: tegra: bpmp: Use scoped device node
handling to simplify error paths").

Commit msg does not explain at all why my code was changed. It is not
only a courtesy but also requirement to mark changes done to commits
when applying.

Shall I assume more of my patches were silently changed when applied,
including adding questionable code there?


Best regards,
Krzysztof