pinctrl: ralink: rt2880: return proper error code
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Sun, 13 Dec 2020 16:17:16 +0000 (17:17 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 4 Jan 2021 14:38:34 +0000 (15:38 +0100)
Check for NULL shall return '-ENOMEM' instead of '-1'.

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-4-sergio.paracuellos@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/ralink/pinctrl-rt2880.c

index c933e1a..6e0bf7c 100644 (file)
@@ -206,7 +206,7 @@ static int rt2880_pinmux_index(struct rt2880_priv *p)
        p->group_names = devm_kcalloc(p->dev, p->group_count,
                                      sizeof(char *), GFP_KERNEL);
        if (!p->group_names)
-               return -1;
+               return -ENOMEM;
 
        for (i = 0; i < p->group_count; i++) {
                p->group_names[i] = p->groups[i].name;