From: Jiale Yao <yaojiale02@163.com>
To: Linus Walleij <linusw@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH v2 3/4] pinctrl: tegra: xusb: free maps on DT map failure
Date: Sat, 3 Oct 2026 16:31:56 +0800 [thread overview]
Message-ID: <20261003083200.459705-4-yaojiale02@163.com> (raw)
In-Reply-To: <20261003083200.459705-1-yaojiale02@163.com>
tegra_xusb_padctl_parse_subnode() can append mappings before a later
child or configuration operation fails. The top-level callback currently
returns the error while retaining all mappings allocated for earlier
children.
Free the accumulated map on failure. The caller ignores the output
parameters when the mapping callback returns an error, so they do not need
to be reset after freeing the map.
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
index c6a51bb21215..fb70f8aee56b 100644
--- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
@@ -248,10 +248,14 @@ static int tegra_xusb_padctl_dt_node_to_map(struct pinctrl_dev *pinctrl,
&reserved_maps,
num_maps);
if (err < 0)
- return err;
+ goto err_free_map;
}
return 0;
+
+err_free_map:
+ pinctrl_utils_free_map(pinctrl, *maps, *num_maps);
+ return err;
}
static const struct pinctrl_ops tegra_xusb_padctl_pinctrl_ops = {
--
2.34.1
next prev parent reply other threads:[~2026-10-03 8:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 8:31 [PATCH v2 0/4] pinctrl: free maps on DT mapping failures Jiale Yao
2026-10-03 8:31 ` [PATCH v2 1/4] pinctrl: sprd: free maps on DT map failure Jiale Yao
2026-10-03 8:31 ` [PATCH v2 2/4] pinctrl: renesas: rzn1: " Jiale Yao
2026-10-03 8:31 ` Jiale Yao [this message]
2026-10-03 8:31 ` [PATCH v2 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=20261003083200.459705-4-yaojiale02@163.com \
--to=yaojiale02@163.com \
--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-tegra@vger.kernel.org \
--cc=thierry.reding@kernel.org \
/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®