Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9222097f authored by Zhen Lei's avatar Zhen Lei Committed by Bjorn Helgaas
Browse files

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: default avatarZhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 6ff33f39
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -172,7 +172,7 @@ static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
	__u32 vendor, device, subvendor = PCI_ANY_ID,
	__u32 vendor, device, subvendor = PCI_ANY_ID,
		subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
		subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
	int fields = 0;
	int fields = 0;
	int retval = -ENODEV;
	size_t retval = -ENODEV;


	fields = sscanf(buf, "%x %x %x %x %x %x",
	fields = sscanf(buf, "%x %x %x %x %x %x",
			&vendor, &device, &subvendor, &subdevice,
			&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)) {
		    !((id->class ^ class) & class_mask)) {
			list_del(&dynid->node);
			list_del(&dynid->node);
			kfree(dynid);
			kfree(dynid);
			retval = 0;
			retval = count;
			break;
			break;
		}
		}
	}
	}
	spin_unlock(&pdrv->dynids.lock);
	spin_unlock(&pdrv->dynids.lock);


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