linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] PCI: remove an unnecessary if statement
@ 2015-09-10 10:40 Zhen Lei
  2015-09-18 21:01 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Zhen Lei @ 2015-09-10 10:40 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel
  Cc: Zefan Li, Xinwei Hu, Tianhong Ding, Hanjun Guo, Yijing Wang,
	Zhen Lei

This patch have no functional change. Successful return count, otherwise
return -ENODEV.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/pci/pci-driver.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 52a880c..02919ec 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -172,7 +172,7 @@ static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
 	__u32 vendor, device, subvendor = PCI_ANY_ID,
 		subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
 	int fields = 0;
-	int retval = -ENODEV;
+	size_t retval = -ENODEV;

 	fields = sscanf(buf, "%x %x %x %x %x %x",
 			&vendor, &device, &subvendor, &subdevice,
@@ -190,15 +190,13 @@ static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
 		    !((id->class ^ class) & class_mask)) {
 			list_del(&dynid->node);
 			kfree(dynid);
-			retval = 0;
+			retval = count;
 			break;
 		}
 	}
 	spin_unlock(&pdrv->dynids.lock);

-	if (retval)
-		return retval;
-	return count;
+	return retval;
 }
 static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id);

--
2.5.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-18 21:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10 10:40 [PATCH 1/1] PCI: remove an unnecessary if statement Zhen Lei
2015-09-18 21:01 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).