Skip to contentSkip to conversation

PCI: Remove redundant initialization of variable rc

PATCH In review Colin King 3 participants 3 messages Sep 10, 2021 – Oct 26, 2021

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 PCI: Remove redundant initialization of variable rc

From: Colin Ian King <[email protected]>

The variable rc is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
index ce2ab62b64cf..cd8cb94cc450 100644
@@ -5288,7 +5288,7 @@ const struct attribute_group pci_dev_reset_method_attr_group = {
  */
 int __pci_reset_function_locked(struct pci_dev *dev)
 {
-	int i, m, rc = -ENOTTY;
+	int i, m, rc;
 
 	might_sleep();
 
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Colin,

Quoted 14 lines

The variable rc is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +0 -0
index ce2ab62b64cf..cd8cb94cc450 100644

drivers/pci/pci.c const struct attribute_group pci_dev_reset_method_attr_group = { · line 5291

Quoted 5 lines
drivers/pci/pci.c +1 -1
@@ -5288,7 +5288,7 @@ const struct attribute_group pci_dev_reset_method_attr_group = {
  */
 int __pci_reset_function_locked(struct pci_dev *dev)
 {
-	int i, m, rc = -ENOTTY;
+	int i, m, rc;

Thank you!

Krzysztof

#2 lore raw
In reply to Colin King
Quoted 7 lines · Colin King

From: Colin Ian King <[email protected]>

The variable rc is being initialized with a value that is never read, it is being updated later on. The assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")

Applied with Krzysztof's reviewed-by to pci/misc for v5.16, thanks!

Quoted 20 lines
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
index ce2ab62b64cf..cd8cb94cc450 100644
@@ -5288,7 +5288,7 @@ const struct attribute_group pci_dev_reset_method_attr_group = {
  */
 int __pci_reset_function_locked(struct pci_dev *dev)
 {
-	int i, m, rc = -ENOTTY;
+	int i, m, rc;
 
 	might_sleep();
 
Signature · 1 line
2.32.0