aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/iov.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/iov.c')
-rw-r--r--drivers/pci/iov.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index fa4b52bb1e05..1d7a7c5b5307 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -186,11 +186,10 @@ static ssize_t sriov_vf_msix_count_store(struct device *dev,
struct pci_dev *vf_dev = to_pci_dev(dev);
struct pci_dev *pdev = pci_physfn(vf_dev);
struct pci_driver *pdrv;
- int val, ret;
+ int val, ret = 0;
- ret = kstrtoint(buf, 0, &val);
- if (ret)
- return ret;
+ if (kstrtoint(buf, 0, &val) < 0)
+ return -EINVAL;
if (val < 0)
return -EINVAL;
@@ -381,12 +380,11 @@ static ssize_t sriov_numvfs_store(struct device *dev,
{
struct pci_dev *pdev = to_pci_dev(dev);
struct pci_driver *pdrv;
- int ret;
+ int ret = 0;
u16 num_vfs;
- ret = kstrtou16(buf, 0, &num_vfs);
- if (ret < 0)
- return ret;
+ if (kstrtou16(buf, 0, &num_vfs) < 0)
+ return -EINVAL;
if (num_vfs > pci_sriov_get_totalvfs(pdev))
return -ERANGE;