All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Long Zhao <longzhao@ambarella.com>
Cc: Linus Walleij <linusw@kernel.org>,
	linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH next] pinctrl: ambarella: fix NULL vs IS_ERR() bug in amb_pinctrl_register()
Date: Fri, 2 Oct 2026 17:42:04 +0300	[thread overview]
Message-ID: <ar_CvNPWBA42BAlx@stanley.mountain> (raw)

The devm_kasprintf_strarray() function never returns NULL, it returns
error pointers on error or a valid pointer on success.  Fix the error
checking to match.

Fixes: b40e9d140c24 ("pinctrl: ambarella: add CV75 pin controller")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/pinctrl/pinctrl-ambarella.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ambarella.c b/drivers/pinctrl/pinctrl-ambarella.c
index 83afef6a123f..5ed1010c5ce5 100644
--- a/drivers/pinctrl/pinctrl-ambarella.c
+++ b/drivers/pinctrl/pinctrl-ambarella.c
@@ -426,8 +426,8 @@ static int amb_pinctrl_register(struct amb_pinctrl *ipc)
 		return -ENOMEM;
 
 	names = devm_kasprintf_strarray(ipc->dev, "io", ipc->data->npins);
-	if (!names)
-		return -ENOMEM;
+	if (IS_ERR(names))
+		return PTR_ERR(names);
 
 	for (unsigned int pin = 0; pin < ipc->data->npins; pin++) {
 		pindesc[pin].number = pin;
-- 
2.53.0


             reply	other threads:[~2026-10-02 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 14:42 Dan Carpenter [this message]
2026-10-02 21:48 ` [PATCH next] pinctrl: ambarella: fix NULL vs IS_ERR() bug in amb_pinctrl_register() Linus Walleij

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=ar_CvNPWBA42BAlx@stanley.mountain \
    --to=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=longzhao@ambarella.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.