Re: [PATCH] PCI: dra7xx: Fix return value in case of error

From: Kishon Vijay Abraham I
Date: Mon Jul 18 2016 - 02:29:35 EST




On Friday 15 July 2016 02:48 AM, Christophe JAILLET wrote:
> In function 'dra7xx_pcie_init_irq_domain', the pattern used to check and
> return error is:
>
> if (!var) {
> dev_err(...);
> return PTR_ERR(var);
> }
>
> So the returned value in case of error is always 0, which means 'success'.
> Change it to return -ENODEV instead.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>

Reviewed-by: Kishon Vijay Abraham I <kishon@xxxxxx>
> ---
> drivers/pci/host/pci-dra7xx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c
> index f441130..81b3949 100644
> --- a/drivers/pci/host/pci-dra7xx.c
> +++ b/drivers/pci/host/pci-dra7xx.c
> @@ -181,14 +181,14 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp)
>
> if (!pcie_intc_node) {
> dev_err(dev, "No PCIe Intc node found\n");
> - return PTR_ERR(pcie_intc_node);
> + return -ENODEV;
> }
>
> pp->irq_domain = irq_domain_add_linear(pcie_intc_node, 4,
> &intx_domain_ops, pp);
> if (!pp->irq_domain) {
> dev_err(dev, "Failed to get a INTx IRQ domain\n");
> - return PTR_ERR(pp->irq_domain);
> + return -ENODEV;
> }
>
> return 0;
>