Skip to contentSkip to conversation

pci: add missing __iomem cast

PATCH In review Carlos Palminha 2 participants 3 messages Jul 19, 2017 – Jul 21, 2017 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: add missing __iomem cast

Add missing __iomem annotation to fix sparse warning:
- incorrect type in return expression (different address spaces)

---
 drivers/pci/rom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/rom.c +1 -1
index b6edb187d160..fa92d8fe6778 100644
@@ -193,7 +193,7 @@ void __iomem *pci_platform_rom(struct pci_dev *pdev, size_t *size)
 {
 	if (pdev->rom && pdev->romlen) {
 		*size = pdev->romlen;
-		return phys_to_virt((phys_addr_t)pdev->rom);
+		return (void __iomem *)phys_to_virt((phys_addr_t)pdev->rom);
 	}
 
 	return NULL;

--
2.11.0

#1 lore raw
Quoted 2 lines · Carlos Palminha

Add missing __iomem annotation to fix sparse warning:
- incorrect type in return expression (different address spaces)

How is this going to shut up sparse without a __force?

And once you add the __force please also add a comment explaining why it's safe.

#2 lore raw

Hi Christoph,

Looking deep into to this, i think there is no need to use phy_to_virts since pdev->rom is already a physical address. That's what pci_platform_rom should return, right?!

I'll probably send a new patch removing the usage of phys_to_virt.

Regards,
C.Palminha

Quoted 9 lines · Christoph Hellwig
Quoted 2 lines · Carlos Palminha

Add missing __iomem annotation to fix sparse warning:
- incorrect type in return expression (different address spaces)

How is this going to shut up sparse without a __force?

And once you add the __force please also add a comment explaining why it's safe.