summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorSergio Paracuellos <sergio.paracuellos@gmail.com>2020-12-13 17:17:17 +0100
committerLinus Walleij <linus.walleij@linaro.org>2021-01-04 15:38:34 +0100
commit09f8101d319a42164b3d1270d2ccbdc156db806a (patch)
treead3949e1e3f5ab6fc7044554cac78da74c6ada48 /drivers/pinctrl
parent7391031be7aa50583aea09bc00a37a74f64c1350 (diff)
downloadlinux-09f8101d319a42164b3d1270d2ccbdc156db806a.tar.gz
linux-09f8101d319a42164b3d1270d2ccbdc156db806a.tar.bz2
linux-09f8101d319a42164b3d1270d2ccbdc156db806a.zip
pinctrl: ralink: rt2880: add missing NULL check
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> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20201213161721.6514-5-sergio.paracuellos@gmail.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/ralink/pinctrl-rt2880.c2
1 files changed, 2 insertions, 0 deletions
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++;