diff options
author | Zhen Lei <thunder.leizhen@huawei.com> | 2015-09-10 18:40:31 +0800 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-09-18 15:55:07 -0500 |
commit | 9222097f0d2f88db602c0340d19d90a1c72b5fec (patch) | |
tree | 90effab76b507f987e7a55fa11b8fe2aceafd8cd /drivers/pci/pci-driver.c | |
parent | 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff) |
PCI: Remove unnecessary "if" statement
In store_remove_id(), set the default return value to -ENODEV, and
overwrite it with the input buffer size if we find a matching list entry.
Then we don't need to test whether to return an error or the count.
No functional change.
[bhelgaas: changelog]
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index dd652f2ae03d..2865ba37e295 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); |