Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2f68b63 authored by Guenter Roeck's avatar Guenter Roeck Committed by Linus Walleij
Browse files

gpio: generic: Revert to old error handling in bgpio_map



Returning an error instead of NULL in bgpio_map if
platform_get_resource_byname does not find a resource was introduced with
commit cf3f2a2c ("gpio: generic: improve error handling in bgpio_map").
This results in several qemu runtime failures with default and non-default
configurations, if attempts are made to boot from mmcblk0. Examples for
failures with multi_v7_defconfig are

Machine: vexpress-a9	dtb: vexpress-v2p-ca9
Machine: vexpress-a15	dtb: vexpress-v2p-ca15-tc1

Crash:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Looking into the code, always returning an error if bgpio_map fails
does not appear to make much sense, since the code in bgpio_setup_io
specifically supports some of the resources to be NULL.

Fixes: cf3f2a2c ("gpio: generic: improve error handling in bgpio_map")
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c307b002
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -586,7 +586,7 @@ static void __iomem *bgpio_map(struct platform_device *pdev,


	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
	if (!r)
	if (!r)
		return IOMEM_ERR_PTR(-EINVAL);
		return NULL;


	sz = resource_size(r);
	sz = resource_size(r);
	if (sz != sane_sz)
	if (sz != sane_sz)