soc: fsl: qe: gpio: Fix an error code in qe_pin_request()
PATCH 1/1 soc: fsl: qe: gpio: Fix an error code in qe_pin_request()
There was a missing error code in this path. It meant that we returned ERR_PTR(0) which is NULL and would result in a NULL dereference in the caller.
--- drivers/soc/fsl/qe/gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/fsl/qe/gpio.c +3 -1
@@ -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.18.0
Quoted 4 lines · Dan Carpenter
There was a missing error code in this path. It meant that we returned
ERR_PTR(0)which is NULL and would result in a NULL dereference in the caller.
Thanks Dan. An early version of this patch has been included in a pending pull request to arm-soc.
https://lkml.org/lkml/2019/5/1/506
Quoted 26 lines
Fixes 1a2d397a6eb5 ("gpio/powerpc: Eliminate duplication of of_get_named_gpio_flags()")Signed-off-by Dan Carpenter <[email protected]>--- drivers/soc/fsl/qe/gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/soc/fsl/qe/gpio.c +3
-2@@ -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.18.0
Quoted 9 lines · Li Yang
Quoted 4 lines · Dan Carpenter
There was a missing error code in this path. It meant that we returned
ERR_PTR(0)which is NULL and would result in a NULL dereference in the caller.Thanks Dan. An early version of this patch has been included in a pending pull request to arm-soc.
https://lkml.org/lkml/2019/5/1/506
Oops. Sorry, I switched computers and forgot to copy my old outbox over. :(
regards,
dan carpenter