Skip to contentSkip to conversation

PCI: Remove unnecessary variable in pci_add_dynid()

PATCH Applied Tobias Klauser 2 participants 2 messages Jul 25, 2014 – Sep 3, 2014 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Remove unnecessary variable in pci_add_dynid()

The variable retval in pci_add_dynid() is only used to store the return value of driver_attach() and is then directly returned. Remove the variable and directly pass on driver_attach()'s return value.

---
 drivers/pci/pci-driver.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/pci-driver.c +1 -4
index d04c5ad..2b3c894 100644
@@ -55,7 +55,6 @@ int pci_add_dynid(struct pci_driver *drv,
 		  unsigned long driver_data)
 {
 	struct pci_dynid *dynid;
-	int retval;
 
 	dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
 	if (!dynid)
@@ -73,9 +72,7 @@ int pci_add_dynid(struct pci_driver *drv,
 	list_add_tail(&dynid->node, &drv->dynids.list);
 	spin_unlock(&drv->dynids.lock);
 
-	retval = driver_attach(&drv->driver);
-
-	return retval;
+	return driver_attach(&drv->driver);
 }
 EXPORT_SYMBOL_GPL(pci_add_dynid);
 
Signature · 1 line
2.0.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Tobias Klauser

The variable retval in pci_add_dynid() is only used to store the return value of driver_attach() and is then directly returned. Remove the variable and directly pass on driver_attach()'s return value.

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

Quoted 31 lines
---
 drivers/pci/pci-driver.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/pci-driver.c +1 -4
index d04c5ad..2b3c894 100644
@@ -55,7 +55,6 @@ int pci_add_dynid(struct pci_driver *drv,
 		  unsigned long driver_data)
 {
 	struct pci_dynid *dynid;
-	int retval;
 
 	dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
 	if (!dynid)
@@ -73,9 +72,7 @@ int pci_add_dynid(struct pci_driver *drv,
 	list_add_tail(&dynid->node, &drv->dynids.list);
 	spin_unlock(&drv->dynids.lock);
 
-	retval = driver_attach(&drv->driver);
-
-	return retval;
+	return driver_attach(&drv->driver);
 }
 EXPORT_SYMBOL_GPL(pci_add_dynid);
 
Signature · 1 line
2.0.1