diff mbox series

[v1] drivers/msi.c : use devm_ioremap replace ioremap

Message ID 20230121170420.8681-1-sensor1010@163.com (mailing list archive)
State Not Applicable
Headers show
Series [v1] drivers/msi.c : use devm_ioremap replace ioremap | expand

Commit Message

李哲 Jan. 21, 2023, 5:04 p.m. UTC
use devm_ioremap replace ioremap

Signed-off-by: Lizhe <sensor1010@163.com>
---
 drivers/pci/msi/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc Zyngier Jan. 22, 2023, 10:47 a.m. UTC | #1
On Sat, 21 Jan 2023 17:04:20 +0000,
Lizhe <sensor1010@163.com> wrote:
> 
> use devm_ioremap replace ioremap
> 
> Signed-off-by: Lizhe <sensor1010@163.com>
> ---
>  drivers/pci/msi/msi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> index 1f716624ca56..184eca85b88b 100644
> --- a/drivers/pci/msi/msi.c
> +++ b/drivers/pci/msi/msi.c
> @@ -566,7 +566,7 @@ static void __iomem *msix_map_region(struct pci_dev *dev,
>  	table_offset &= PCI_MSIX_TABLE_OFFSET;
>  	phys_addr = pci_resource_start(dev, bir) + table_offset;
>  
> -	return ioremap(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
> +	return devm_ioremap(&dev->dev, phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
>  }

And where is the unmap dealt with? From what I can see, this will
probably explode when the device is removed...

	 M.
Leon Romanovsky Jan. 22, 2023, 12:52 p.m. UTC | #2
On Sun, Jan 22, 2023 at 10:47:21AM +0000, Marc Zyngier wrote:
> On Sat, 21 Jan 2023 17:04:20 +0000,
> Lizhe <sensor1010@163.com> wrote:
> > 
> > use devm_ioremap replace ioremap
> > 
> > Signed-off-by: Lizhe <sensor1010@163.com>
> > ---
> >  drivers/pci/msi/msi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> > index 1f716624ca56..184eca85b88b 100644
> > --- a/drivers/pci/msi/msi.c
> > +++ b/drivers/pci/msi/msi.c
> > @@ -566,7 +566,7 @@ static void __iomem *msix_map_region(struct pci_dev *dev,
> >  	table_offset &= PCI_MSIX_TABLE_OFFSET;
> >  	phys_addr = pci_resource_start(dev, bir) + table_offset;
> >  
> > -	return ioremap(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
> > +	return devm_ioremap(&dev->dev, phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
> >  }
> 
> And where is the unmap dealt with? From what I can see, this will
> probably explode when the device is removed...

Right, he/she sends many random patches like this.
https://lore.kernel.org/all/Y8Pt+IdfWBVy8nIA@unreal/

Thanks

> 
> 	 M.
> 
> -- 
> Without deviation from the norm, progress is not possible.
diff mbox series

Patch

diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 1f716624ca56..184eca85b88b 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -566,7 +566,7 @@  static void __iomem *msix_map_region(struct pci_dev *dev,
 	table_offset &= PCI_MSIX_TABLE_OFFSET;
 	phys_addr = pci_resource_start(dev, bir) + table_offset;
 
-	return ioremap(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
+	return devm_ioremap(&dev->dev, phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
 }
 
 /**