Skip to contentSkip to conversation

PCI: xgene: Remove unused assignment to variable msi_val

PATCH Applied Krzysztof Wilczyński 4 participants 4 messages Sep 22, 2020 – Oct 2, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: xgene: Remove unused assignment to variable msi_val

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

---
 drivers/pci/controller/pci-xgene-msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/pci-xgene-msi.c +2 -2
index 02271c6d17a1..2470782cb01a 100644
@@ -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);
+
 		/* Read MSIINTn to confirm */
 		msi_val = xgene_msi_int_read(xgene_msi, irq_index);
 		if (msi_val) {
Signature · 1 line
2.28.0
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Krzysztof Wilczyński

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

---
 drivers/pci/controller/pci-xgene-msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/pci-xgene-msi.c +0 -0
index 02271c6d17a1..2470782cb01a 100644

drivers/pci/controller/pci-xgene-msi.c static int xgene_msi_probe(struct platform_device *pdev) · line 497

Quoted 7 lines
drivers/pci/controller/pci-xgene-msi.c +2 -2
@@ -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.

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

Quoted 11 lines
drivers/pci/controller/pci-xgene-msi.c +0 -0
 		/* Read MSIINTn to confirm */
 		msi_val = xgene_msi_int_read(xgene_msi, irq_index);
 		if (msi_val) {
Signature · 7 lines
2.28.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Krzysztof Wilczyński
Quoted 5 lines · Krzysztof Wilczyński

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.

Quoted 9 lines

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

---
 drivers/pci/controller/pci-xgene-msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#3 lore raw
In reply to Krzysztof Wilczyński
Quoted 5 lines · Krzysztof Wilczyński

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.

Quoted 8 lines

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

---
 drivers/pci/controller/pci-xgene-msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to pci/xgene, thanks.

Lorenzo

Quoted 18 lines
drivers/pci/controller/pci-xgene-msi.c +2 -2
index 02271c6d17a1..2470782cb01a 100644
@@ -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);
+
 		/* Read MSIINTn to confirm */
 		msi_val = xgene_msi_int_read(xgene_msi, irq_index);
 		if (msi_val) {
Signature · 1 line
2.28.0