gpio-amd8111: add release_region on ioport_map failure
authorVarka Bhadram <varkab@cdac.in>
Mon, 19 Jan 2015 08:05:48 +0000 (13:35 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 19 Jan 2015 08:48:45 +0000 (09:48 +0100)
Commit ffe4770b9b3483f74 ("gpio-amd8111: check ioport_map return value")
adds the error check on ioport_map(). It doesnt release the requested region.

On failure this patch release the region that has requested before.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Reported-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-amd8111.c

index 2c4d9ab..d00d819 100644 (file)
@@ -215,6 +215,7 @@ found:
        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");
+               release_region(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE);
                err = -ENOMEM;
                goto out;
        }