All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xianwei Zhao" <xianwei.zhao@amlogic.com>
Cc: linux-amlogic@lists.infradead.org, linux-gpio@vger.kernel.org,
	neil.armstrong@linaro.org
Subject: Re: [PATCH] pinctrl: amlogic: a4: Allow functions without groups
Date: Fri, 06 Nov 2026 07:18:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-200985@kernel.org> (raw)
In-Reply-To: <20261106-debug-info-v1-1-067c5c554f91@amlogic.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] pinctrl: amlogic: a4: bogus IS_ERR_OR_NULL() check in
  aml_pctl_probe_dt()
--

commit 52848e3d0d015ec420063e02e0337040b95e6237
Author: Xianwei Zhao <xianwei.zhao@amlogic.com>

pinctrl: amlogic: a4: Allow functions without groups

This commit allows pinctrl function nodes in the device tree to have no
child groups and ignores non-GPIO child nodes without a "func-" prefix.

> diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> index 39eb8cc7fc0d1..d0e3cec3ead03 100644
> --- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> +++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c

[ ... ]

> @@ -1128,7 +1134,8 @@ static int aml_pctl_probe_dt(struct platform_device *pdev,
>  
>  	info->banks = devm_kcalloc(dev, info->nbanks, sizeof(*info->banks), GFP_KERNEL);
>  
> -	if (!info->functions || !info->groups || !info->banks)
> +	if (IS_ERR_OR_NULL(info->functions) || IS_ERR_OR_NULL(info->groups) ||
> +	    IS_ERR_OR_NULL(info->banks))
>  		return -ENOMEM;

[Severity: Medium]
Does IS_ERR_OR_NULL() match what devm_kcalloc() returns here?

devm_kcalloc() returns NULL on failure or ZERO_SIZE_PTR ((void *)16) for a
zero-sized allocation, never an ERR_PTR().  Although the commit message
states that this checks for ZERO_SIZE_PTR, IS_ERR_OR_NULL(ZERO_SIZE_PTR)
is false, and rejecting ZERO_SIZE_PTR with -ENOMEM would fail probing
whenever info->ngroups or info->nfunctions is zero.  The original NULL
checks already caught allocation failures while allowing ZERO_SIZE_PTR.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-debug-info-v1-1-067c5c554f91@amlogic.com?part=1

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Xianwei Zhao" <xianwei.zhao@amlogic.com>
Cc: linux-amlogic@lists.infradead.org, linux-gpio@vger.kernel.org,
	neil.armstrong@linaro.org
Subject: Re: [PATCH] pinctrl: amlogic: a4: Allow functions without groups
Date: Fri, 06 Nov 2026 07:18:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-200985@kernel.org> (raw)
In-Reply-To: <20261106-debug-info-v1-1-067c5c554f91@amlogic.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] pinctrl: amlogic: a4: bogus IS_ERR_OR_NULL() check in
  aml_pctl_probe_dt()
--

commit 52848e3d0d015ec420063e02e0337040b95e6237
Author: Xianwei Zhao <xianwei.zhao@amlogic.com>

pinctrl: amlogic: a4: Allow functions without groups

This commit allows pinctrl function nodes in the device tree to have no
child groups and ignores non-GPIO child nodes without a "func-" prefix.

> diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> index 39eb8cc7fc0d1..d0e3cec3ead03 100644
> --- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> +++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c

[ ... ]

> @@ -1128,7 +1134,8 @@ static int aml_pctl_probe_dt(struct platform_device *pdev,
>  
>  	info->banks = devm_kcalloc(dev, info->nbanks, sizeof(*info->banks), GFP_KERNEL);
>  
> -	if (!info->functions || !info->groups || !info->banks)
> +	if (IS_ERR_OR_NULL(info->functions) || IS_ERR_OR_NULL(info->groups) ||
> +	    IS_ERR_OR_NULL(info->banks))
>  		return -ENOMEM;

[Severity: Medium]
Does IS_ERR_OR_NULL() match what devm_kcalloc() returns here?

devm_kcalloc() returns NULL on failure or ZERO_SIZE_PTR ((void *)16) for a
zero-sized allocation, never an ERR_PTR().  Although the commit message
states that this checks for ZERO_SIZE_PTR, IS_ERR_OR_NULL(ZERO_SIZE_PTR)
is false, and rejecting ZERO_SIZE_PTR with -ENOMEM would fail probing
whenever info->ngroups or info->nfunctions is zero.  The original NULL
checks already caught allocation failures while allowing ZERO_SIZE_PTR.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-debug-info-v1-1-067c5c554f91@amlogic.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-11-06  7:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  7:08 [PATCH] pinctrl: amlogic: a4: Allow functions without groups Xianwei Zhao via B4 Relay
2026-11-06  7:08 ` Xianwei Zhao
2026-11-06  7:08 ` Xianwei Zhao via B4 Relay
2026-11-06  7:18 ` sashiko-bot [this message]
2026-11-06  7:18   ` sashiko-bot

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-200985@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xianwei.zhao@amlogic.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 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.