diff mbox series

[4/8] pinctrl: ralink: rt2880: add missing NULL check

Message ID 20201213161721.6514-5-sergio.paracuellos@gmail.com
State Accepted
Commit 09f8101d319a42164b3d1270d2ccbdc156db806a
Headers show
Series pinctrl: ralink: rt2880: Some minimal clean ups | expand

Commit Message

Sergio Paracuellos Dec. 13, 2020, 4:17 p.m. UTC
Memory is being requested to the kernel but there is
a missing check for NULL. Hence, add it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/pinctrl/ralink/pinctrl-rt2880.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/pinctrl/ralink/pinctrl-rt2880.c b/drivers/pinctrl/ralink/pinctrl-rt2880.c
index 6e0bf7c4837b..3c3336b724ca 100644
--- a/drivers/pinctrl/ralink/pinctrl-rt2880.c
+++ b/drivers/pinctrl/ralink/pinctrl-rt2880.c
@@ -238,6 +238,8 @@  static int rt2880_pinmux_index(struct rt2880_priv *p)
 			p->func[c] = &p->groups[i].func[j];
 			p->func[c]->groups = devm_kzalloc(p->dev, sizeof(int),
 						    GFP_KERNEL);
+			if (!p->func[c]->groups)
+				return -ENOMEM;
 			p->func[c]->groups[0] = i;
 			p->func[c]->group_count = 1;
 			c++;