linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] gpio: generic: improve error handling in bgpio_map
@ 2015-09-30 21:50 Heiner Kallweit
  2015-10-05  7:14 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2015-09-30 21:50 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio

If bgpio_map returns NULL then err should always be set.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/gpio/gpio-generic.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index a3f0753..eefff1a 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)
-- 
2.6.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-05  7:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 21:50 [PATCH 1/3] gpio: generic: improve error handling in bgpio_map Heiner Kallweit
2015-10-05  7:14 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).