aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/huawei
diff options
context:
space:
mode:
authorLuo bin <luobin9@huawei.com>2020-07-01 11:16:33 +0800
committerDavid S. Miller <davem@davemloft.net>2020-07-01 12:14:04 -0700
commitd3c54f7f18cb82283777998c4bec52e49241c783 (patch)
treecba02624e13eb1d28da289f7771687a908d2e809 /drivers/net/ethernet/huawei
parentnet: qrtr: Fix an out of bounds read qrtr_endpoint_post() (diff)
downloadlinux-dev-d3c54f7f18cb82283777998c4bec52e49241c783.tar.xz
linux-dev-d3c54f7f18cb82283777998c4bec52e49241c783.zip
hinic: fix passing non negative value to ERR_PTR
get_dev_cap and set_resources_state functions may return a positive value because of hardware failure, and the positive return value can not be passed to ERR_PTR directly. Fixes: 7dd29ee12865 ("hinic: add sriov feature support") Signed-off-by: Luo bin <luobin9@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/huawei')
-rw-r--r--drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
index 0245da02efbb..b735bc537508 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
@@ -814,6 +814,8 @@ err_aeqs_init:
err_init_msix:
err_pfhwdev_alloc:
hinic_free_hwif(hwif);
+ if (err > 0)
+ err = -EIO;
return ERR_PTR(err);
}