public inbox for ntb@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] PCI: endpoint: pci-epf-vntb: Fix the incorrect usage of __iomem attribute
@ 2025-07-09 12:50 Manivannan Sadhasivam
  2025-07-09 21:14 ` Frank Li
  0 siblings, 1 reply; 2+ messages in thread
From: Manivannan Sadhasivam @ 2025-07-09 12:50 UTC (permalink / raw)
  To: jdmason, dave.jiang, allenbh, kwilczynski, bhelgaas
  Cc: ntb, linux-pci, linux-kernel, Manivannan Sadhasivam

__iomem attribute is supposed to be used only with variables holding the
MMIO pointer. But here, 'mw_addr' variable is just holding a 'void *'
returned by pci_epf_alloc_space(). So annotating it with __iomem is clearly
wrong. Hence, drop the attribute.

This also fixes the below sparse warning:

  drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17: warning: incorrect type in assignment (different address spaces)
  drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17:    expected void [noderef] __iomem *mw_addr
  drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17:    got void *
  drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21: warning: incorrect type in assignment (different address spaces)
  drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21:    expected unsigned int [usertype] *epf_db
  drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21:    got void [noderef] __iomem *mw_addr
  drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38: warning: incorrect type in argument 2 (different address spaces)
  drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38:    expected void *addr
  drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38:    got void [noderef] __iomem *mw_addr

Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
---
 drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
index ac83a6dc6116..83e9ab10f9c4 100644
--- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
+++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
@@ -512,7 +512,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
 	struct device *dev = &ntb->epf->dev;
 	int ret;
 	struct pci_epf_bar *epf_bar;
-	void __iomem *mw_addr;
+	void *mw_addr;
 	enum pci_barno barno;
 	size_t size = sizeof(u32) * ntb->db_count;
 
-- 
2.45.2


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

* Re: [PATCH] PCI: endpoint: pci-epf-vntb: Fix the incorrect usage of __iomem attribute
  2025-07-09 12:50 [PATCH] PCI: endpoint: pci-epf-vntb: Fix the incorrect usage of __iomem attribute Manivannan Sadhasivam
@ 2025-07-09 21:14 ` Frank Li
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Li @ 2025-07-09 21:14 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: jdmason, dave.jiang, allenbh, kwilczynski, bhelgaas, ntb,
	linux-pci, linux-kernel

On Wed, Jul 09, 2025 at 06:20:22PM +0530, Manivannan Sadhasivam wrote:
> __iomem attribute is supposed to be used only with variables holding the
> MMIO pointer. But here, 'mw_addr' variable is just holding a 'void *'
> returned by pci_epf_alloc_space(). So annotating it with __iomem is clearly
> wrong. Hence, drop the attribute.
>
> This also fixes the below sparse warning:
>
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17: warning: incorrect type in assignment (different address spaces)
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17:    expected void [noderef] __iomem *mw_addr
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17:    got void *
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21: warning: incorrect type in assignment (different address spaces)
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21:    expected unsigned int [usertype] *epf_db
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21:    got void [noderef] __iomem *mw_addr
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38: warning: incorrect type in argument 2 (different address spaces)
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38:    expected void *addr
>   drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38:    got void [noderef] __iomem *mw_addr
>
> Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index ac83a6dc6116..83e9ab10f9c4 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -512,7 +512,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
>  	struct device *dev = &ntb->epf->dev;
>  	int ret;
>  	struct pci_epf_bar *epf_bar;
> -	void __iomem *mw_addr;
> +	void *mw_addr;
>  	enum pci_barno barno;
>  	size_t size = sizeof(u32) * ntb->db_count;
>
> --
> 2.45.2
>

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

end of thread, other threads:[~2025-07-09 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 12:50 [PATCH] PCI: endpoint: pci-epf-vntb: Fix the incorrect usage of __iomem attribute Manivannan Sadhasivam
2025-07-09 21:14 ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox