diff mbox

[gpio] gpio-amd8111: check ioport_map return value

Message ID 1419842341-22694-1-git-send-email-varkab@cdac.in
State New, archived
Headers show

Commit Message

Varka Bhadram Dec. 29, 2014, 8:39 a.m. UTC
ioport_map() may fail. Its safe to check the return value.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/gpio/gpio-amd8111.c |    5 +++++
 1 file changed, 5 insertions(+)

Comments

Varka Bhadram Jan. 7, 2015, 3:21 a.m. UTC | #1
Ping ..?

On Mon, Dec 29, 2014 at 2:09 PM, Varka Bhadram <varkabhadram@gmail.com> wrote:
> ioport_map() may fail. Its safe to check the return value.
>
> Signed-off-by: Varka Bhadram <varkab@cdac.in>
> ---
>  drivers/gpio/gpio-amd8111.c |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c
> index 3c09f1a6..a0585c3 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;
>
> --
> 1.7.9.5
>
Linus Walleij Jan. 14, 2015, 12:31 p.m. UTC | #2
On Mon, Dec 29, 2014 at 9:39 AM, Varka Bhadram <varkabhadram@gmail.com> wrote:

> ioport_map() may fail. Its safe to check the return value.
>
> Signed-off-by: Varka Bhadram <varkab@cdac.in>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c
index 3c09f1a6..a0585c3 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;