diff mbox series

pinctrl: ti: fix error return code of ti_iodelay_dt_node_to_map()

Message ID 20210330062655.1027-1-angkery@163.com
State New
Headers show
Series pinctrl: ti: fix error return code of ti_iodelay_dt_node_to_map() | expand

Commit Message

Junlin Yang March 30, 2021, 6:26 a.m. UTC
From: Junlin Yang <yangjunlin@yulong.com>

when devm_kcalloc fails, use -ENOMEM instead of -EINVAL,
and consistent with other devm_kcalloc return values.

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
---
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Linus Walleij April 8, 2021, 1:57 p.m. UTC | #1
On Tue, Mar 30, 2021 at 10:39 AM angkery <angkery@163.com> wrote:

> From: Junlin Yang <yangjunlin@yulong.com>

>

> when devm_kcalloc fails, use -ENOMEM instead of -EINVAL,

> and consistent with other devm_kcalloc return values.

>

> Signed-off-by: Junlin Yang <yangjunlin@yulong.com>


Patch applied.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
index e584826..4e23827 100644
--- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
+++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
@@ -511,8 +511,10 @@  static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev,
 	}
 
 	pins = devm_kcalloc(iod->dev, rows, sizeof(*pins), GFP_KERNEL);
-	if (!pins)
+	if (!pins) {
+		error = -ENOMEM;
 		goto free_group;
+	}
 
 	cfg = devm_kcalloc(iod->dev, rows, sizeof(*cfg), GFP_KERNEL);
 	if (!cfg) {