All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Krzysztof Wilczyński" <kw@linux.com>
Cc: Toan Le <toan@os.amperecomputing.com>,
	Rob Herring <robh@kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	linux-pci@vger.kernel.org, Duc Dang <dhdang@apm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: xgene: Remove unused assignment to variable msi_val
Date: Tue, 22 Sep 2020 09:52:45 -0500	[thread overview]
Message-ID: <20200922145245.GA2201556@bjorn-Precision-5520> (raw)
In-Reply-To: <20200922030257.459898-1-kw@linux.com>

On Tue, Sep 22, 2020 at 03:02:57AM +0000, Krzysztof Wilczyński wrote:
> The value assigned to msi_val after the inner loop finishes its run is
> never used for anything, and it is also immediately overridden in the
> line that follows with the return value from the xgene_msi_int_read()
> function.
> 
> Since the value of msi_val following the inner loop completion is never
> used in any meaningful way the assignment can be removed.
> 
> Addresses-Coverity-ID: 1437183 ("Unused value")
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
> ---
>  drivers/pci/controller/pci-xgene-msi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c
> index 02271c6d17a1..2470782cb01a 100644
> --- a/drivers/pci/controller/pci-xgene-msi.c
> +++ b/drivers/pci/controller/pci-xgene-msi.c
> @@ -493,8 +493,8 @@ static int xgene_msi_probe(struct platform_device *pdev)
>  	 */
>  	for (irq_index = 0; irq_index < NR_HW_IRQS; irq_index++) {
>  		for (msi_idx = 0; msi_idx < IDX_PER_GROUP; msi_idx++)
> -			msi_val = xgene_msi_ir_read(xgene_msi, irq_index,
> -						    msi_idx);
> +			xgene_msi_ir_read(xgene_msi, irq_index, msi_idx);
> +

Interesting.  One might expect that throwing away the result of a read
means the read itself is pointless, but fortunately there's a comment
just above explaining that these registers are read-to-clear.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Assuming Toan acks this, Lorenzo will likely pick it up when he
returns next week.

>  		/* Read MSIINTn to confirm */
>  		msi_val = xgene_msi_int_read(xgene_msi, irq_index);
>  		if (msi_val) {
> -- 
> 2.28.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Krzysztof Wilczyński" <kw@linux.com>
Cc: Rob Herring <robh@kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	linux-pci@vger.kernel.org, Duc Dang <dhdang@apm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Toan Le <toan@os.amperecomputing.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: xgene: Remove unused assignment to variable msi_val
Date: Tue, 22 Sep 2020 09:52:45 -0500	[thread overview]
Message-ID: <20200922145245.GA2201556@bjorn-Precision-5520> (raw)
In-Reply-To: <20200922030257.459898-1-kw@linux.com>

On Tue, Sep 22, 2020 at 03:02:57AM +0000, Krzysztof Wilczyński wrote:
> The value assigned to msi_val after the inner loop finishes its run is
> never used for anything, and it is also immediately overridden in the
> line that follows with the return value from the xgene_msi_int_read()
> function.
> 
> Since the value of msi_val following the inner loop completion is never
> used in any meaningful way the assignment can be removed.
> 
> Addresses-Coverity-ID: 1437183 ("Unused value")
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
> ---
>  drivers/pci/controller/pci-xgene-msi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c
> index 02271c6d17a1..2470782cb01a 100644
> --- a/drivers/pci/controller/pci-xgene-msi.c
> +++ b/drivers/pci/controller/pci-xgene-msi.c
> @@ -493,8 +493,8 @@ static int xgene_msi_probe(struct platform_device *pdev)
>  	 */
>  	for (irq_index = 0; irq_index < NR_HW_IRQS; irq_index++) {
>  		for (msi_idx = 0; msi_idx < IDX_PER_GROUP; msi_idx++)
> -			msi_val = xgene_msi_ir_read(xgene_msi, irq_index,
> -						    msi_idx);
> +			xgene_msi_ir_read(xgene_msi, irq_index, msi_idx);
> +

Interesting.  One might expect that throwing away the result of a read
means the read itself is pointless, but fortunately there's a comment
just above explaining that these registers are read-to-clear.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Assuming Toan acks this, Lorenzo will likely pick it up when he
returns next week.

>  		/* Read MSIINTn to confirm */
>  		msi_val = xgene_msi_int_read(xgene_msi, irq_index);
>  		if (msi_val) {
> -- 
> 2.28.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-22 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22  3:02 [PATCH] PCI: xgene: Remove unused assignment to variable msi_val Krzysztof Wilczyński
2020-09-22  3:02 ` Krzysztof Wilczyński
2020-09-22 14:52 ` Bjorn Helgaas [this message]
2020-09-22 14:52   ` Bjorn Helgaas
2020-10-01 14:42 ` Rob Herring
2020-10-01 14:42   ` Rob Herring
2020-10-02 12:00 ` Lorenzo Pieralisi
2020-10-02 12:00   ` Lorenzo Pieralisi

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=20200922145245.GA2201556@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dhdang@apm.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robh@kernel.org \
    --cc=toan@os.amperecomputing.com \
    /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.