Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio-amd8111: add release_region on ioport_map failure

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>

authored by

Varka Bhadram and committed by
Linus Walleij
51385858 a0b66e3f

+1
+1
drivers/gpio/gpio-amd8111.c
··· 215 215 gp.pm = ioport_map(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE); 216 216 if (!gp.pm) { 217 217 dev_err(&pdev->dev, "Couldn't map io port into io memory\n"); 218 + release_region(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE); 218 219 err = -ENOMEM; 219 220 goto out; 220 221 }