diff mbox

PCI: xilinx: testing wrong variable in setup irq function

Message ID 20140909121150.GD19760@mwanda
State Accepted
Headers show

Commit Message

Dan Carpenter Sept. 9, 2014, 12:11 p.m. UTC
We should be testing "hwirq" instead of "irq".  "irq" is unsigned so
it's never less than zero.  Also it's uninitialized.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
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

Comments

Srikanth Thokala Sept. 9, 2014, 12:31 p.m. UTC | #1
Hi Dan,

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Tuesday, September 09, 2014 5:42 PM
> To: Bjorn Helgaas; Srikanth Thokala
> Cc: Michal Simek; Grant Likely; Rob Herring; Srikanth Thokala; Arnd Bergmann;
> linux-pci@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [patch] PCI: xilinx: testing wrong variable in setup irq function
>
> We should be testing "hwirq" instead of "irq".  "irq" is unsigned so it's never less
> than zero.  Also it's uninitialized.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c index
> 44f8944..ccc496b 100644
> --- a/drivers/pci/host/pcie-xilinx.c
> +++ b/drivers/pci/host/pcie-xilinx.c
> @@ -359,8 +359,8 @@ static int xilinx_pcie_msi_setup_irq(struct msi_chip
> *chip,
>       phys_addr_t msg_addr;
>
>       hwirq = xilinx_pcie_assign_msi(port);
> -     if (irq < 0)
> -             return irq;
> +     if (hwirq < 0)
> +             return hwirq;

It is a typo from my end, thanks for sending this patch.
Really thanks for helping to improve this.

Acked-by: Srikanth Thokala <sthokal@xilinx.com>

- Srikanth

>
>       irq = irq_create_mapping(port->irq_domain, hwirq);
>       if (!irq)


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

--
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
Bjorn Helgaas Sept. 16, 2014, 11:47 p.m. UTC | #2
On Tue, Sep 09, 2014 at 03:11:50PM +0300, Dan Carpenter wrote:
> We should be testing "hwirq" instead of "irq".  "irq" is unsigned so
> it's never less than zero.  Also it's uninitialized.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied with Srikanth's ack to pci/host-xilinx for v3.18, thanks.

> 
> diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
> index 44f8944..ccc496b 100644
> --- a/drivers/pci/host/pcie-xilinx.c
> +++ b/drivers/pci/host/pcie-xilinx.c
> @@ -359,8 +359,8 @@ static int xilinx_pcie_msi_setup_irq(struct msi_chip *chip,
>  	phys_addr_t msg_addr;
>  
>  	hwirq = xilinx_pcie_assign_msi(port);
> -	if (irq < 0)
> -		return irq;
> +	if (hwirq < 0)
> +		return hwirq;
>  
>  	irq = irq_create_mapping(port->irq_domain, hwirq);
>  	if (!irq)
--
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/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index 44f8944..ccc496b 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -359,8 +359,8 @@  static int xilinx_pcie_msi_setup_irq(struct msi_chip *chip,
 	phys_addr_t msg_addr;
 
 	hwirq = xilinx_pcie_assign_msi(port);
-	if (irq < 0)
-		return irq;
+	if (hwirq < 0)
+		return hwirq;
 
 	irq = irq_create_mapping(port->irq_domain, hwirq);
 	if (!irq)