gpio: xgene: Prevent NULL pointer dereference
PATCH 1/1 gpio: xgene: Prevent NULL pointer dereference
platform_get_resource() can return NULL, thus add NULL test to prevent NULL pointer dereference.
Signed-off-by Axel Lin <[email protected]>
--- drivers/gpio/gpio-xgene.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpio/gpio-xgene.c +5 -0
@@ -173,6 +173,11 @@ static int xgene_gpio_probe(struct platform_device *pdev) } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) { + err = -EINVAL ; + goto err; + } + gpio->base =devm_ioremap_nocache (&pdev->dev, res->start,resource_size (res));if (!gpio->base) {
Signature · 1 line
2.1.4
Quoted 4 lines · Axel Lin
platform_get_resource()can return NULL, thus add NULL test to prevent NULL pointer dereference.Signed-off-by Axel Lin <[email protected]>
Patch applied for fixes.
Yours,
Linus Walleij