]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
hinic: fix passing non negative value to ERR_PTR
authorLuo bin <luobin9@huawei.com>
Wed, 1 Jul 2020 03:16:33 +0000 (11:16 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Jul 2020 19:14:04 +0000 (12:14 -0700)
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>
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c

index 0245da02efbb0952b326e436a053fbcbd1a0f765..b735bc537508fcda0526238f7de5082d798598ff 100644 (file)
@@ -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);
 }