All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-pci <linux-pci@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Simon Horman <horms@verge.net.au>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH v2] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
Date: Thu, 2 Nov 2017 20:25:50 +0100	[thread overview]
Message-ID: <CAMuHMdVgte--7gOnp9DFZCKUsneT-S9ttO3gninnfhv43BOyKQ@mail.gmail.com> (raw)
In-Reply-To: <a55409b0-9839-d9b5-5c90-606c22d0c58b@users.sourceforge.net>

On Thu, Nov 2, 2017 at 2:00 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 2 Nov 2017 13:35:17 +0100
>
> * Adjust a jump target so that a specific error message is stored only once
>   at the end of this function implementation.
>
> * Replace two calls of the function "dev_err" by goto statements.
>
> This issue was detected by using the Coccinelle software.
>
> Link: https://lkml.org/lkml/2017/11/2/140
> Link: https://lkml.kernel.org/r/<20171102081239.bzaunax3uotejqja@verge.net.au>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>
> v2:
> An other jump label was requested by Simon Horman.
>
>  drivers/pci/host/pcie-rcar.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 12796eccb2be..f3c1ffdf8072 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>         err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         /* setup MSI data target */
>         msi->pages = __get_free_pages(GFP_KERNEL, 0);
> @@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>
>         return 0;
>
> -err:
> +err_remove_domain:
> +       dev_err(dev, "failed to request IRQ: %d\n", err);

Moving the error message is confusing and counter-productive:
if you need to add another error case + goto err_remove_domain
later, you'll have to move it back to all the older cases.

Hence
NAKed-by: Geert Uytterhoeven <geert@linux-m68k.org>

>         irq_domain_remove(msi->domain);
>         return err;
>  }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-pci <linux-pci@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Simon Horman <horms@verge.net.au>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH v2] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi()
Date: Thu, 02 Nov 2017 19:25:50 +0000	[thread overview]
Message-ID: <CAMuHMdVgte--7gOnp9DFZCKUsneT-S9ttO3gninnfhv43BOyKQ@mail.gmail.com> (raw)
In-Reply-To: <a55409b0-9839-d9b5-5c90-606c22d0c58b@users.sourceforge.net>

On Thu, Nov 2, 2017 at 2:00 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 2 Nov 2017 13:35:17 +0100
>
> * Adjust a jump target so that a specific error message is stored only once
>   at the end of this function implementation.
>
> * Replace two calls of the function "dev_err" by goto statements.
>
> This issue was detected by using the Coccinelle software.
>
> Link: https://lkml.org/lkml/2017/11/2/140
> Link: https://lkml.kernel.org/r/<20171102081239.bzaunax3uotejqja@verge.net.au>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>
> v2:
> An other jump label was requested by Simon Horman.
>
>  drivers/pci/host/pcie-rcar.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
> index 12796eccb2be..f3c1ffdf8072 100644
> --- a/drivers/pci/host/pcie-rcar.c
> +++ b/drivers/pci/host/pcie-rcar.c
> @@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>         err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
>                                IRQF_SHARED | IRQF_NO_THREAD,
>                                rcar_msi_irq_chip.name, pcie);
> -       if (err < 0) {
> -               dev_err(dev, "failed to request IRQ: %d\n", err);
> -               goto err;
> -       }
> +       if (err < 0)
> +               goto err_remove_domain;
>
>         /* setup MSI data target */
>         msi->pages = __get_free_pages(GFP_KERNEL, 0);
> @@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>
>         return 0;
>
> -err:
> +err_remove_domain:
> +       dev_err(dev, "failed to request IRQ: %d\n", err);

Moving the error message is confusing and counter-productive:
if you need to add another error case + goto err_remove_domain
later, you'll have to move it back to all the older cases.

Hence
NAKed-by: Geert Uytterhoeven <geert@linux-m68k.org>

>         irq_domain_remove(msi->domain);
>         return err;
>  }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

  reply	other threads:[~2017-11-02 19:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30  7:35 [PATCH] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi() SF Markus Elfring
2017-10-30  7:35 ` SF Markus Elfring
2017-11-01  8:18 ` Simon Horman
2017-11-01  8:18   ` Simon Horman
2017-11-01  8:57   ` SF Markus Elfring
2017-11-01  8:57     ` SF Markus Elfring
2017-11-02  8:12     ` Simon Horman
2017-11-02  8:12       ` Simon Horman
2017-11-02 13:00       ` [PATCH v2] " SF Markus Elfring
2017-11-02 13:00         ` SF Markus Elfring
2017-11-02 19:25         ` Geert Uytterhoeven [this message]
2017-11-02 19:25           ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMuHMdVgte--7gOnp9DFZCKUsneT-S9ttO3gninnfhv43BOyKQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=bhelgaas@google.com \
    --cc=elfring@users.sourceforge.net \
    --cc=horms@verge.net.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.