diff mbox

[V3,3/3] PCI: mvebu: return NULL instead of ERR_PTR(ret)

Message ID 000101ceb826$8695b7f0$93c127d0$%han@samsung.com
State Not Applicable
Headers show

Commit Message

Jingoo Han Sept. 23, 2013, 6:31 a.m. UTC
Return NULL instead of ERR_PTR(ret) in order to fix the following
sparse warning:

drivers/pci/host/pci-mvebu.c:744:31: warning: incorrect type in return expression (different address spaces)
drivers/pci/host/pci-mvebu.c:744:31:    expected void [noderef] <asn:2>*
drivers/pci/host/pci-mvebu.c:744:31:    got void *

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 drivers/pci/host/pci-mvebu.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Jingoo Han Oct. 15, 2013, 9:12 a.m. UTC | #1
On Monday, September 23, 2013 3:31 PM, Jingoo Han wrote:
> 
> Return NULL instead of ERR_PTR(ret) in order to fix the following
> sparse warning:
> 
> drivers/pci/host/pci-mvebu.c:744:31: warning: incorrect type in return expression (different address
> spaces)
> drivers/pci/host/pci-mvebu.c:744:31:    expected void [noderef] <asn:2>*
> drivers/pci/host/pci-mvebu.c:744:31:    got void *
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

(+cc Andrew Lunn, Gregory Clement)

Hi Jason Cooper,

Would you apply this patch into your 'linux-mvebu.git' tree?
It was already Acked by Thomas Petazzoni.
Also, it is a trivial change to fix sparse warning.
Thank you.

Best regards,
Jingoo Han

> ---
>  drivers/pci/host/pci-mvebu.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index 0bd3ba8..fb2474f 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -741,7 +741,7 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
> 
>  	ret = of_address_to_resource(np, 0, &regs);
>  	if (ret)
> -		return ERR_PTR(ret);
> +		return NULL;
> 
>  	return devm_ioremap_resource(&pdev->dev, &regs);
>  }
> @@ -940,10 +940,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
>  			continue;
> 
>  		port->base = mvebu_pcie_map_registers(pdev, child, port);
> -		if (IS_ERR(port->base)) {
> +		if (!port->base) {
>  			dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
>  				port->port, port->lane);
> -			port->base = NULL;
>  			clk_disable_unprepare(port->clk);
>  			continue;
>  		}
> --
> 1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Cooper Oct. 17, 2013, 1:04 p.m. UTC | #2
On Tue, Oct 15, 2013 at 06:12:07PM +0900, Jingoo Han wrote:
> On Monday, September 23, 2013 3:31 PM, Jingoo Han wrote:
> > 
> > Return NULL instead of ERR_PTR(ret) in order to fix the following
> > sparse warning:
> > 
> > drivers/pci/host/pci-mvebu.c:744:31: warning: incorrect type in return expression (different address
> > spaces)
> > drivers/pci/host/pci-mvebu.c:744:31:    expected void [noderef] <asn:2>*
> > drivers/pci/host/pci-mvebu.c:744:31:    got void *
> > 
> > Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> > Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> 
> (+cc Andrew Lunn, Gregory Clement)
> 
> Hi Jason Cooper,
> 
> Would you apply this patch into your 'linux-mvebu.git' tree?
> It was already Acked by Thomas Petazzoni.
> Also, it is a trivial change to fix sparse warning.
> Thank you.

Applied to mvebu/drivers

thx,

Jason.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 0bd3ba8..fb2474f 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -741,7 +741,7 @@  static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
 
 	ret = of_address_to_resource(np, 0, &regs);
 	if (ret)
-		return ERR_PTR(ret);
+		return NULL;
 
 	return devm_ioremap_resource(&pdev->dev, &regs);
 }
@@ -940,10 +940,9 @@  static int mvebu_pcie_probe(struct platform_device *pdev)
 			continue;
 
 		port->base = mvebu_pcie_map_registers(pdev, child, port);
-		if (IS_ERR(port->base)) {
+		if (!port->base) {
 			dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
 				port->port, port->lane);
-			port->base = NULL;
 			clk_disable_unprepare(port->clk);
 			continue;
 		}