mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "jiale yao" <19888972804@163.com>
To: "Geert Uytterhoeven" <geert@linux-m68k.org>
Cc: "Linus Walleij" <linusw@kernel.org>,
	"Orson Zhai" <orsonzhai@gmail.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Chunyan Zhang" <zhang.lyra@gmail.com>,
	"Thierry Reding" <thierry.reding@kernel.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>,
	linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re:Re: [PATCH 2/4] pinctrl: renesas: rzn1: free maps on DT map failure
Date: Tue, 29 Sep 2026 16:07:05 +0800 (CST)	[thread overview]
Message-ID: <7eaa18c1.6909.1a0ec33ffd4.Coremail.19888972804@163.com> (raw)
In-Reply-To: <CAMuHMdUaPuhy==YAKxUsBTCddCu9pEixPckkYYgoy=LXprnYog@mail.gmail.com>

Hi Geert,

At 2026-09-28 21:19:48, "Geert Uytterhoeven" <geert@linux-m68k.org> wrote:
>Hi Jiale,
>
>On Thu, 24 Sept 2026 at 13:19, Jiale Yao <yaojiale02@163.com> wrote:
>> rzn1_dt_node_to_map_one() appends mappings for each DT node.  If a
>> node fails after map storage has been reserved, the top-level callback
>> returns without releasing mappings built for the current and previous
>> nodes.
>>
>> Free the accumulated map and clear the output parameters on every error
>> path.
>>
>> Signed-off-by: Jiale Yao <yaojiale02@163.com>
>
>Thanks for your patch!
>
>> --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
>> +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
>> @@ -411,15 +411,21 @@ static int rzn1_dt_node_to_map(struct pinctrl_dev *pctldev,
>>
>>         ret = rzn1_dt_node_to_map_one(pctldev, np, map, num_maps);
>>         if (ret < 0)
>> -               return ret;
>> +               goto err_free_map;
>>
>>         for_each_child_of_node_scoped(np, child) {
>>                 ret = rzn1_dt_node_to_map_one(pctldev, child, map, num_maps);
>>                 if (ret < 0)
>> -                       return ret;
>> +                       goto err_free_map;
>>         }
>>
>>         return 0;
>> +
>> +err_free_map:
>> +       pinctrl_utils_free_map(pctldev, *map, *num_maps);
>
>Nice catch!
>
>> +       *map = NULL;
>> +       *num_maps = 0;
>
>Is the resetting actually needed?
>Only pinctrl-generic.c, pinctrl-sprd.c, and pinctrl-tegra-xusb.c seem
>to do that

No, the resetting is not needed, as the caller does not inspect the
output parameters when dt_node_to_map() returns an error.

I'll drop both assignments and update the commit message in v2.

.
>
>> +       return ret;
>>  }
>>
>>  static const struct pinctrl_ops rzn1_pctrl_ops = {
>
>Gr{oetje,eeting}s,
>
>                        Geert
>
>
>--
>Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
>In personal conversations with technical people, I call myself a hacker. But
>when I'm talking to journalists I just say "programmer" or something like that.
>                                -- Linus Torvalds

Jiale

  reply	other threads:[~2026-09-29  8:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 11:18 [PATCH 0/4] pinctrl: free maps on DT mapping failures Jiale Yao
2026-09-24 11:18 ` [PATCH 1/4] pinctrl: sprd: free maps on DT map failure Jiale Yao
2026-09-29  6:08   ` Baolin Wang
2026-09-24 11:18 ` [PATCH 2/4] pinctrl: renesas: rzn1: " Jiale Yao
2026-09-28 13:19   ` Geert Uytterhoeven
2026-09-29  8:07     ` jiale yao [this message]
2026-09-24 11:18 ` [PATCH 3/4] pinctrl: tegra: xusb: " Jiale Yao
2026-09-24 11:18 ` [PATCH 4/4] pinctrl: samsung: " Jiale Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7eaa18c1.6909.1a0ec33ffd4.Coremail.19888972804@163.com \
    --to=19888972804@163.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=geert@linux-m68k.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=thierry.reding@kernel.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®