From: Varka Bhadram Date: Mon, 29 Dec 2014 08:39:01 +0000 (+0530) Subject: gpio-amd8111: check ioport_map return value X-Git-Tag: v5.15~16365^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ffe4770b9b3483f74bccd0566fd1013ddc1b6d6b;p=platform%2Fkernel%2Flinux-starfive.git gpio-amd8111: check ioport_map return value ioport_map() may fail. Its safe to check the return value. Signed-off-by: Varka Bhadram Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c index d3d2d10..2c4d9ab 100644 --- a/drivers/gpio/gpio-amd8111.c +++ b/drivers/gpio/gpio-amd8111.c @@ -213,6 +213,11 @@ found: goto out; } gp.pm = ioport_map(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE); + if (!gp.pm) { + dev_err(&pdev->dev, "Couldn't map io port into io memory\n"); + err = -ENOMEM; + goto out; + } gp.pdev = pdev; gp.chip.dev = &pdev->dev;