From: sashiko-bot@kernel.org
To: "Zhiqi Zhang" <zhiqizhangg@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v2 1/4] ASoC: codecs: pm4125: check component match allocation
Date: Fri, 04 Dec 2026 13:21:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-249853@kernel.org> (raw)
In-Reply-To: <20261204125837.81419-2-zhiqizhangg@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ASoC: pm4125: driver workaround conflicts with component core
error handling
--
commit 5670d13c3334f605590dbc9132ebd2c33509847a
Author: Zhiqi Zhang <zhiqizhangg@gmail.com>
ASoC: codecs: pm4125: check component match allocation
This commit checks *matchptr for error pointers after each
component_match_add_release() call in pm4125_add_slave_components() and
drops the corresponding rxnode or txnode reference on failure.
> diff --git a/sound/soc/codecs/pm4125.c b/sound/soc/codecs/pm4125.c
> index 22fada77b2740..f5b37ec038276 100644
> --- a/sound/soc/codecs/pm4125.c
> +++ b/sound/soc/codecs/pm4125.c
> @@ -1625,18 +1625,31 @@ static int pm4125_add_slave_components(struct pm4125_priv *pm4125, struct device
> struct component_match **matchptr)
> {
> struct device_node *np = dev->of_node;
> + int ret;
>
> pm4125->rxnode = of_parse_phandle(np, "qcom,rx-device", 0);
> if (!pm4125->rxnode)
> return dev_err_probe(dev, -ENODEV, "Couldn't parse phandle to qcom,rx-device\n");
> component_match_add_release(dev, matchptr, component_release_of, component_compare_of,
> pm4125->rxnode);
> + if (IS_ERR(*matchptr)) {
> + ret = PTR_ERR(*matchptr);
> + of_node_put(pm4125->rxnode);
> + pm4125->rxnode = NULL;
> + return ret;
> + }
[Severity: Low]
Should this be fixed in drivers/base/component.c instead of working around it
in pm4125_add_slave_components()?
Both issues originate in the component core: __component_match_add() returns
without calling release(parent, compare_data) on allocation failure, and
component_master_add_with_match() dereferences match->num without checking
IS_ERR(match).
Because component_match_add_release() returns void to let callers batch
additions, wrappers like drm_of_component_match_add() take an of_node_get()
and leave callers no way to drop it on error.
Manually calling of_node_put() here leaves those other callers unfixed and
will cause a double of_node_put() if __component_match_add() is later fixed
to invoke release() on error.
Calling release() on the error paths in __component_match_add() and returning
PTR_ERR(match) when IS_ERR(match) in component_master_add_with_match() would
handle both problems uniformly for all callers.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204125837.81419-1-zhiqizhangg@gmail.com?part=1
next prev parent reply other threads:[~2026-12-04 13:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 12:58 [PATCH v2 0/4] ASoC: codecs: handle component match allocation failures Zhiqi Zhang
2026-12-04 12:58 ` [PATCH v2 1/4] ASoC: codecs: pm4125: check component match allocation Zhiqi Zhang
2026-12-04 13:21 ` sashiko-bot [this message]
2026-12-04 12:58 ` [PATCH v2 2/4] ASoC: codecs: wcd937x: " Zhiqi Zhang
2026-12-04 12:58 ` [PATCH v2 3/4] ASoC: codecs: wcd938x: " Zhiqi Zhang
2026-12-04 13:30 ` sashiko-bot
2026-12-04 12:58 ` [PATCH v2 4/4] ASoC: codecs: wcd939x: " Zhiqi Zhang
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=sashiko-outbox-249853@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhiqizhangg@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