From b4b9bd92fe3f1ad147f3fe753b4fe4d7726ec741 Mon Sep 17 00:00:00 2001 From: Weihang Li Date: Thu, 20 Jun 2019 16:52:40 +0800 Subject: [PATCH] net: hns3: modify handling of out of memory in hclge_err.c Users should be informed if HNS driver failed to allocate memory for descriptor when handling hw errors. This patch solve above issues. Signed-off-by: Weihang Li Signed-off-by: Peng Li Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c index 3dfb265a3d54..dd7b8a8c7771 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c @@ -1859,7 +1859,7 @@ static int hclge_handle_all_hw_msix_error(struct hclge_dev *hdev, if (ret) { dev_err(dev, "fail(%d) to query msix int status bd num\n", ret); - return ret; + goto out; } mpf_bd_num = le32_to_cpu(desc_bd.data[0]); @@ -1867,8 +1867,10 @@ static int hclge_handle_all_hw_msix_error(struct hclge_dev *hdev, bd_num = max_t(u32, mpf_bd_num, pf_bd_num); desc = kcalloc(bd_num, sizeof(struct hclge_desc), GFP_KERNEL); - if (!desc) + if (!desc) { + ret = -ENOMEM; goto out; + } ret = hclge_handle_mpf_msix_error(hdev, desc, mpf_bd_num, reset_requests); -- 2.30.2