Skip to contentSkip to conversation

hinic: fix passing non negative value to ERR_PTR

PATCH Applied Luo bin 2 participants 2 messages Jul 1, 2020

Subsystems (3)
lore
Share & tools
lore

Luo bin

author
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c +2 -0
index 0245da02efbb..b735bc537508 100644
@@ -814,6 +814,8 @@ struct hinic_hwdev *hinic_init_hwdev(struct pci_dev *pdev)
 err_init_msix:
 err_pfhwdev_alloc:
 	hinic_free_hwif(hwif);
+	if (err > 0)
+		err = -EIO;
 	return ERR_PTR(err);
 }
 
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw

From: Luo bin <[email protected]>
Date: Wed, 1 Jul 2020 11:16:33 +0800

Quoted 6 lines

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")

Applied, thank you.