Patchwork [3/3] PCI: mvebu: add missing __iomem annotation

login
register
mail settings
Submitter Jingoo Han
Date Sept. 12, 2013, 9:37 a.m.
Message ID <000501ceaf9b$acaec690$060c53b0$%han@samsung.com>
Download mbox | patch
Permalink /patch/274484/
State Superseded
Headers show

Comments

Jingoo Han - Sept. 12, 2013, 9:37 a.m.
Added missing __iomem annotation in order to fix the following
sparse warning:

drivers/pci/host/pci-mvebu.c:744:31: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-mvebu.c:744:31:    expected void [noderef] <asn:2>*
drivers/pci/host/pci-mvebu.c:744:31:    got void *

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/pci/host/pci-mvebu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Thomas Petazzoni - Sept. 16, 2013, 3:57 p.m.
Dear Jingoo Han,

On Thu, 12 Sep 2013 18:37:18 +0900, Jingoo Han wrote:

>  	ret = of_address_to_resource(np, 0, &regs);
>  	if (ret)
> -		return ERR_PTR(ret);
> +		return (void __iomem *)ERR_PTR(ret);

This doesn't look very pretty to tell the truth, but I don't quite see
any other option. Just return NULL when of_address_to_resource() fails
instead of trying to propagate the error? Make this entire function
return an 'int' and have the iomem address returned through a pointer
passed by address as argument to the function? Any other suggestion?

Thanks,

Thomas

Patch

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index b54ceb1..2d8e478 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -741,7 +741,7 @@  static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
 
 	ret = of_address_to_resource(np, 0, &regs);
 	if (ret)
-		return ERR_PTR(ret);
+		return (void __iomem *)ERR_PTR(ret);
 
 	return devm_ioremap_resource(&pdev->dev, &regs);
 }