diff mbox

pinctrl: return -ENOMEM instead of -EINVAL for kasprintf() failure

Message ID 1464174853-9297-1-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit 1fb1f0540deae634d454f917e3d45c27b69521a8
Headers show

Commit Message

Masahiro Yamada May 25, 2016, 11:14 a.m. UTC
-ENOMEM is more suitable error code because kasprintf() fails
in case of memory shortage.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 drivers/pinctrl/pinmux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Linus Walleij May 31, 2016, 8:33 a.m. UTC | #1
On Wed, May 25, 2016 at 1:14 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> -ENOMEM is more suitable error code because kasprintf() fails

> in case of memory shortage.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


Obviously correct.

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index d94d76c..ece7028 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -256,7 +256,7 @@  int pinmux_request_gpio(struct pinctrl_dev *pctldev,
 	/* Conjure some name stating what chip and pin this is taken by */
 	owner = kasprintf(GFP_KERNEL, "%s:%d", range->name, gpio);
 	if (!owner)
-		return -EINVAL;
+		return -ENOMEM;
 
 	ret = pin_request(pctldev, pin, owner, range);
 	if (ret < 0)