linux/drivers/pinctrl/bcm
Wei Yongjun c29e9da56b pinctrl: nsp: Fix potential NULL dereference
platform_get_resource() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap_nocache(e1, res->start, e2);

Fixes: cc4fa83f66 ("pinctrl: nsp: add pinmux driver support for Broadcom NSP SoC")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-07-14 12:47:04 +02:00
..
Kconfig
Makefile
pinctrl-bcm281xx.c
pinctrl-bcm2835.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-cygnus-mux.c
pinctrl-iproc-gpio.c
pinctrl-ns2-mux.c
pinctrl-nsp-gpio.c
pinctrl-nsp-mux.c pinctrl: nsp: Fix potential NULL dereference 2018-07-14 12:47:04 +02:00