Skip to contentSkip to conversation

pinctrl: ambarella: fix NULL vs IS_ERR() bug in amb_pinctrl_register()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 2

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: ambarella: fix NULL vs IS_ERR() bug in amb_pinctrl_register()

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")
---
 drivers/pinctrl/pinctrl-ambarella.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-ambarella.c +2 -2
index 83afef6a123f..5ed1010c5ce5 100644
@@ -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;
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 6 lines · Dan Carpenter

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")

Patch applied!

Yours,
Linus Walleij