Skip to contentSkip to conversation

soc/fsl/qe: Fix an error code in qe_pin_request()

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 28, 2019 – Apr 2, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc/fsl/qe: Fix an error code in qe_pin_request()

We forgot to set "err" on this error path.

Fixes 1a2d397a6eb5 ("gpio/powerpc: Eliminate duplication of of_get_named_gpio_flags()")
---
 drivers/soc/fsl/qe/gpio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/fsl/qe/gpio.c +3 -1
index 819bed0f5667..51b3a47b5a55 100644
@@ -179,8 +179,10 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
 	if (err < 0)
 		goto err0;
 	gc = gpio_to_chip(err);
-	if (WARN_ON(!gc))
+	if (WARN_ON(!gc)) {
+		err = -ENODEV;
 		goto err0;
+	}
 
 	if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) {
 		pr_debug("%s: tried to get a non-qe pin\n", __func__);
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 5 lines · Dan Carpenter

We forgot to set "err" on this error path.

Fixes 1a2d397a6eb5 ("gpio/powerpc: Eliminate duplication of of_get_named_gpio_flags()")

Applied to fix branch. Thanks.

Regards,
Leo

Quoted 23 lines
---
 drivers/soc/fsl/qe/gpio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/fsl/qe/gpio.c +3 -2
index 819bed0f5667..51b3a47b5a55 100644
@@ -179,8 +179,10 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
        if (err < 0)
                goto err0;
        gc = gpio_to_chip(err);
-       if (WARN_ON(!gc))
+       if (WARN_ON(!gc)) {
+               err = -ENODEV;
                goto err0;
+       }
 
        if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) {
                pr_debug("%s: tried to get a non-qe pin\n", __func__);
--

2.17.1