Commit cf3f2a2c authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Linus Walleij

gpio: generic: improve error handling in bgpio_map

If bgpio_map returns NULL then err should always be set.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 2db8aba8
...@@ -591,8 +591,10 @@ static void __iomem *bgpio_map(struct platform_device *pdev, ...@@ -591,8 +591,10 @@ static void __iomem *bgpio_map(struct platform_device *pdev,
*err = 0; *err = 0;
r = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); r = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
if (!r) if (!r) {
*err = -EINVAL;
return NULL; return NULL;
}
sz = resource_size(r); sz = resource_size(r);
if (sz != sane_sz) { if (sz != sane_sz) {
...@@ -637,8 +639,8 @@ static int bgpio_pdev_probe(struct platform_device *pdev) ...@@ -637,8 +639,8 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
sz = resource_size(r); sz = resource_size(r);
dat = bgpio_map(pdev, "dat", sz, &err); dat = bgpio_map(pdev, "dat", sz, &err);
if (!dat) if (err)
return err ? err : -EINVAL; return err;
set = bgpio_map(pdev, "set", sz, &err); set = bgpio_map(pdev, "set", sz, &err);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment