diff options
author | Heiner Kallweit | 2015-09-30 23:50:20 +0200 |
---|---|---|
committer | Linus Walleij | 2015-10-05 09:13:39 +0200 |
commit | cf3f2a2c8bae0db72233629c9da9d9f617b3f8af (patch) | |
tree | 9e538ad4fbdf9f5887a7e669cc369e06a5e006e9 /drivers | |
parent | 2db8aba860c70478f6af18c410a3e513a2d2f541 (diff) |
gpio: generic: improve error handling in bgpio_map
If bgpio_map returns NULL then err should always be set.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpio/gpio-generic.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c index a3f07537fe62..eefff1a29986 100644 --- a/drivers/gpio/gpio-generic.c +++ b/drivers/gpio/gpio-generic.c @@ -591,8 +591,10 @@ static void __iomem *bgpio_map(struct platform_device *pdev, *err = 0; r = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); - if (!r) + if (!r) { + *err = -EINVAL; return NULL; + } sz = resource_size(r); if (sz != sane_sz) { @@ -637,8 +639,8 @@ static int bgpio_pdev_probe(struct platform_device *pdev) sz = resource_size(r); dat = bgpio_map(pdev, "dat", sz, &err); - if (!dat) - return err ? err : -EINVAL; + if (err) + return err; set = bgpio_map(pdev, "set", sz, &err); if (err) |