Re: [PATCH 3/4] PCI: rcar: Add missing irq_dispose_mapping() into failpath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marek,

On Mon, May 21, 2018 at 3:11 PM, Marek Vasut <marek.vasut@xxxxxxxxx> wrote:
> The rcar_pcie_get_resources() is another misnomer with a side effect.
> The function does not only get resources, but also maps MSI IRQs via
> irq_of_parse_and_map(). In case anything fails afterward, the IRQ
> mapping must be disposed through irq_dispose_mapping() which is not
> done.
>
> This patch handles irq_of_parse_and_map() failures in by disposing
> of the mapping in rcar_pcie_get_resources() as well as in probe.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@xxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -923,18 +923,25 @@ static int rcar_pcie_get_resources(struct rcar_pcie *pcie)
>         i = irq_of_parse_and_map(dev->of_node, 0);
>         if (!i) {
>                 dev_err(dev, "cannot get platform resources for msi interrupt\n");
> -               return -ENOENT;
> +               err = -ENOENT;
> +               goto err_irq1;

You could have kept the return here.

>         }
>         pcie->msi.irq1 = i;
>
>         i = irq_of_parse_and_map(dev->of_node, 1);
>         if (!i) {
>                 dev_err(dev, "cannot get platform resources for msi interrupt\n");
> -               return -ENOENT;
> +               err = -ENOENT;
> +               goto err_irq2;
>         }
>         pcie->msi.irq2 = i;
>
>         return 0;
> +
> +err_irq2:
> +       irq_dispose_mapping(pcie->msi.irq1);
> +err_irq1:
> +       return err;
>  }
>
>  static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux