Skip to content

Commit 73a0c2b

Browse files
committed
PCI: spear13xx: Avoid invalid address space conversions
The sparse checker complains about converting pointers between address spaces. We correctly stored an __iomem pointer in struct spear13xx_pcie, but discarded the __iomem when extracting app_base, causing one warning. Then we passed the non-__iomem pointer to writel(), which expects an __iomem pointer, causing another warning. Add the appropriate annotations. The sparse warnings look like this: $ make C=2 drivers/pci/controller/ drivers/pci/controller/dwc/pcie-spear13xx.c:72:54: warning: incorrect type in initializer (different address spaces) drivers/pci/controller/dwc/pcie-spear13xx.c:72:54: expected struct pcie_app_reg *app_reg drivers/pci/controller/dwc/pcie-spear13xx.c:72:54: got void [noderef] __iomem *app_base drivers/pci/controller/dwc/pcie-spear13xx.c:78:26: warning: incorrect type in argument 2 (different address spaces) drivers/pci/controller/dwc/pcie-spear13xx.c:78:26: expected void volatile [noderef] __iomem *addr drivers/pci/controller/dwc/pcie-spear13xx.c:78:26: got unsigned int * Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Helgaas <[email protected]> Cc: Pratyush Anand <[email protected]>
1 parent 088c840 commit 73a0c2b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/pci/controller/dwc/pcie-spear13xx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct pcie_app_reg {
6969
static int spear13xx_pcie_start_link(struct dw_pcie *pci)
7070
{
7171
struct spear13xx_pcie *spear13xx_pcie = to_spear13xx_pcie(pci);
72-
struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
72+
struct pcie_app_reg __iomem *app_reg = spear13xx_pcie->app_base;
7373

7474
/* enable ltssm */
7575
writel(DEVICE_TYPE_RC | (1 << MISCTRL_EN_ID)
@@ -83,7 +83,7 @@ static int spear13xx_pcie_start_link(struct dw_pcie *pci)
8383
static irqreturn_t spear13xx_pcie_irq_handler(int irq, void *arg)
8484
{
8585
struct spear13xx_pcie *spear13xx_pcie = arg;
86-
struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
86+
struct pcie_app_reg __iomem *app_reg = spear13xx_pcie->app_base;
8787
struct dw_pcie *pci = spear13xx_pcie->pci;
8888
struct pcie_port *pp = &pci->pp;
8989
unsigned int status;
@@ -102,7 +102,7 @@ static irqreturn_t spear13xx_pcie_irq_handler(int irq, void *arg)
102102

103103
static void spear13xx_pcie_enable_interrupts(struct spear13xx_pcie *spear13xx_pcie)
104104
{
105-
struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
105+
struct pcie_app_reg __iomem *app_reg = spear13xx_pcie->app_base;
106106

107107
/* Enable MSI interrupt */
108108
if (IS_ENABLED(CONFIG_PCI_MSI))
@@ -113,7 +113,7 @@ static void spear13xx_pcie_enable_interrupts(struct spear13xx_pcie *spear13xx_pc
113113
static int spear13xx_pcie_link_up(struct dw_pcie *pci)
114114
{
115115
struct spear13xx_pcie *spear13xx_pcie = to_spear13xx_pcie(pci);
116-
struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
116+
struct pcie_app_reg __iomem *app_reg = spear13xx_pcie->app_base;
117117

118118
if (readl(&app_reg->app_status_1) & XMLH_LINK_UP)
119119
return 1;

0 commit comments

Comments
 (0)