Skip to contentSkip to conversation

PCI: remove an unnecessary if condition before a return statement

PATCH Applied Quentin Lambert 3 participants 3 messages Nov 7, 2014 – Nov 11, 2014 PCI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PCI: remove an unnecessary if condition before a return statement

Simplify a trivial if-return sequence. Possibly combine with a preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

---

Changes in v2:
- remove a checkpatch warning due to the a space between after the function name.

 drivers/pci/hotplug/ibmphp_res.c | 5 +----
 drivers/pci/pci.c                | 6 +-----
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/pci/hotplug/ibmphp_res.c +1 -4
index 219ba80..2da59ef 100644
@@ -376,10 +376,7 @@ int __init ibmphp_rsrc_init (void)
 		if (rc)
 			return rc;
 	}
-	rc = once_over ();  /* This is to align ranges (so no -1) */
-	if (rc)
-		return rc;
-	return 0;
+	return once_over();
 }
 
 /********************************************************************************
drivers/pci/pci.c +1 -5
index 625a4ac..9a5871f 100644
@@ -1012,11 +1012,7 @@ int pci_save_state(struct pci_dev *dev)
 	if (i != 0)
 		return i;
 
-	i = pci_save_vc_state(dev);
-	if (i != 0)
-		return i;
-
-	return 0;
+	return pci_save_vc_state(dev);
 }
 EXPORT_SYMBOL(pci_save_state);
 
Signature · 1 line
1.9.1
#1 lore raw

Hi Quentin,

Quoted 20 lines · Quentin Lambert

Simplify a trivial if-return sequence. Possibly combine with a preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

---

Changes in v2:
- remove a checkpatch warning due to the a space between after the function name.

 drivers/pci/hotplug/ibmphp_res.c | 5 +----
 drivers/pci/pci.c                | 6 +-----
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/pci/hotplug/ibmphp_res.c +0 -0
index 219ba80..2da59ef 100644

drivers/pci/hotplug/ibmphp_res.c int __init ibmphp_rsrc_init (void) · line 379

Quoted 8 lines
drivers/pci/hotplug/ibmphp_res.c +1 -4
@@ -376,10 +376,7 @@ int __init ibmphp_rsrc_init (void)
                if (rc)
                        return rc;
        }
-       rc = once_over ();  /* This is to align ranges (so no -1) */
-       if (rc)
-               return rc;
-       return 0;
+       return once_over();

I think we need to retain the comment?

- Srikanth

Quoted 27 lines
drivers/pci/hotplug/ibmphp_res.c +0 -0
 }
 
 /********************************************************************************
drivers/pci/pci.c +1 -6
index 625a4ac..9a5871f 100644
@@ -1012,11 +1012,7 @@ int pci_save_state(struct pci_dev *dev)
        if (i != 0)
                return i;
 
-       i = pci_save_vc_state(dev);
-       if (i != 0)
-               return i;
-
-       return 0;
+       return pci_save_vc_state(dev);
 }
 EXPORT_SYMBOL(pci_save_state);
 
--

1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#2 lore raw
In reply to Quentin Lambert

[+cc Srikanth]

Quoted 5 lines · Quentin Lambert

Simplify a trivial if-return sequence. Possibly combine with a preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

Applied to pci/misc for v3.19, thanks!

I have no idea what it means, but I did add back the comment as Srikanth pointed out.

Quoted 46 lines

---

Changes in v2:
- remove a checkpatch warning due to the a space between after the function name.

 drivers/pci/hotplug/ibmphp_res.c | 5 +----
 drivers/pci/pci.c                | 6 +-----
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/pci/hotplug/ibmphp_res.c +1 -4
index 219ba80..2da59ef 100644
@@ -376,10 +376,7 @@ int __init ibmphp_rsrc_init (void)
 		if (rc)
 			return rc;
 	}
-	rc = once_over ();  /* This is to align ranges (so no -1) */
-	if (rc)
-		return rc;
-	return 0;
+	return once_over();
 }
 
 /********************************************************************************
drivers/pci/pci.c +1 -5
index 625a4ac..9a5871f 100644
@@ -1012,11 +1012,7 @@ int pci_save_state(struct pci_dev *dev)
 	if (i != 0)
 		return i;
 
-	i = pci_save_vc_state(dev);
-	if (i != 0)
-		return i;
-
-	return 0;
+	return pci_save_vc_state(dev);
 }
 EXPORT_SYMBOL(pci_save_state);
 
Signature · 1 line
1.9.1