linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] PCI: dwc: fix a warning about variable 'res' is uninitialized
@ 2020-07-17 13:30 Dejin Zheng
  2020-07-17 16:31 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 3+ messages in thread
From: Dejin Zheng @ 2020-07-17 13:30 UTC (permalink / raw)
  To: m-karicheri2, lorenzo.pieralisi, robh, bhelgaas,
	gustavo.pimentel, linux-pci
  Cc: linux-kernel, Dejin Zheng, kernel test robot

The kernel test robot reported a compile warning,

drivers/pci/controller/dwc/pci-keystone.c:1236:18: warning: variable 'res'
is uninitialized when used here [-Wuninitialized]

The commit c59a7d771134b5 ("PCI: dwc: Convert to
devm_platform_ioremap_resource_byname()") did a wrong conversion for
keystone driver. the commit use devm_platform_ioremap_resource_byname()
to replace platform_get_resource_byname() and devm_ioremap_resource().
but the subsequent code needs to use the variable 'res', which is got by
platform_get_resource_byname() for resource "app". so revert it.

Fixes: c59a7d771134b5 ("PCI: dwc: Convert to devm_platform_ioremap_resource_byname()")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/pci/controller/dwc/pci-keystone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index 5ffc3b40c4f6..00279002102e 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -1228,8 +1228,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
 	if (!pci)
 		return -ENOMEM;
 
-	ks_pcie->va_app_base =
-		devm_platform_ioremap_resource_byname(pdev, "app");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "app");
+	ks_pcie->va_app_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(ks_pcie->va_app_base))
 		return PTR_ERR(ks_pcie->va_app_base);
 
-- 
2.25.0


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

* Re: [PATCH v1] PCI: dwc: fix a warning about variable 'res' is uninitialized
  2020-07-17 13:30 [PATCH v1] PCI: dwc: fix a warning about variable 'res' is uninitialized Dejin Zheng
@ 2020-07-17 16:31 ` Lorenzo Pieralisi
  2020-07-17 16:43   ` Dejin Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-17 16:31 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: m-karicheri2, robh, bhelgaas, gustavo.pimentel, linux-pci,
	linux-kernel, kernel test robot

On Fri, Jul 17, 2020 at 09:30:07PM +0800, Dejin Zheng wrote:
> The kernel test robot reported a compile warning,
> 
> drivers/pci/controller/dwc/pci-keystone.c:1236:18: warning: variable 'res'
> is uninitialized when used here [-Wuninitialized]
> 
> The commit c59a7d771134b5 ("PCI: dwc: Convert to
> devm_platform_ioremap_resource_byname()") did a wrong conversion for
> keystone driver. the commit use devm_platform_ioremap_resource_byname()
> to replace platform_get_resource_byname() and devm_ioremap_resource().
> but the subsequent code needs to use the variable 'res', which is got by
> platform_get_resource_byname() for resource "app". so revert it.
> 
> Fixes: c59a7d771134b5 ("PCI: dwc: Convert to devm_platform_ioremap_resource_byname()")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-keystone.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Squashed in the commit it is fixing, thanks.

Lorenzo

> diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
> index 5ffc3b40c4f6..00279002102e 100644
> --- a/drivers/pci/controller/dwc/pci-keystone.c
> +++ b/drivers/pci/controller/dwc/pci-keystone.c
> @@ -1228,8 +1228,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
>  	if (!pci)
>  		return -ENOMEM;
>  
> -	ks_pcie->va_app_base =
> -		devm_platform_ioremap_resource_byname(pdev, "app");
> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "app");
> +	ks_pcie->va_app_base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(ks_pcie->va_app_base))
>  		return PTR_ERR(ks_pcie->va_app_base);
>  
> -- 
> 2.25.0
> 

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

* Re: [PATCH v1] PCI: dwc: fix a warning about variable 'res' is uninitialized
  2020-07-17 16:31 ` Lorenzo Pieralisi
@ 2020-07-17 16:43   ` Dejin Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Dejin Zheng @ 2020-07-17 16:43 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: m-karicheri2, robh, bhelgaas, gustavo.pimentel, linux-pci,
	linux-kernel, kernel test robot

On Fri, Jul 17, 2020 at 05:31:11PM +0100, Lorenzo Pieralisi wrote:
> On Fri, Jul 17, 2020 at 09:30:07PM +0800, Dejin Zheng wrote:
> > The kernel test robot reported a compile warning,
> > 
> > drivers/pci/controller/dwc/pci-keystone.c:1236:18: warning: variable 'res'
> > is uninitialized when used here [-Wuninitialized]
> > 
> > The commit c59a7d771134b5 ("PCI: dwc: Convert to
> > devm_platform_ioremap_resource_byname()") did a wrong conversion for
> > keystone driver. the commit use devm_platform_ioremap_resource_byname()
> > to replace platform_get_resource_byname() and devm_ioremap_resource().
> > but the subsequent code needs to use the variable 'res', which is got by
> > platform_get_resource_byname() for resource "app". so revert it.
> > 
> > Fixes: c59a7d771134b5 ("PCI: dwc: Convert to devm_platform_ioremap_resource_byname()")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> > ---
> >  drivers/pci/controller/dwc/pci-keystone.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Squashed in the commit it is fixing, thanks.
>
Lorenzo, Thanks a lot for your help.

BR,
Dejin

> Lorenzo
> 
> > diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
> > index 5ffc3b40c4f6..00279002102e 100644
> > --- a/drivers/pci/controller/dwc/pci-keystone.c
> > +++ b/drivers/pci/controller/dwc/pci-keystone.c
> > @@ -1228,8 +1228,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
> >  	if (!pci)
> >  		return -ENOMEM;
> >  
> > -	ks_pcie->va_app_base =
> > -		devm_platform_ioremap_resource_byname(pdev, "app");
> > +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "app");
> > +	ks_pcie->va_app_base = devm_ioremap_resource(dev, res);
> >  	if (IS_ERR(ks_pcie->va_app_base))
> >  		return PTR_ERR(ks_pcie->va_app_base);
> >  
> > -- 
> > 2.25.0
> > 

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

end of thread, other threads:[~2020-07-17 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 13:30 [PATCH v1] PCI: dwc: fix a warning about variable 'res' is uninitialized Dejin Zheng
2020-07-17 16:31 ` Lorenzo Pieralisi
2020-07-17 16:43   ` Dejin Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).