Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp324546ybe; Tue, 10 Sep 2019 19:47:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJRZT7PVIEQlFUqmmhfMgoz1I1cpNgkV/aDBrLLn0GFgwE6QJzXSvCwhGcT1vZHkERToTR X-Received: by 2002:a50:ce53:: with SMTP id k19mr34145635edj.2.1568170042960; Tue, 10 Sep 2019 19:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568170042; cv=none; d=google.com; s=arc-20160816; b=tI5PRZ16pdjrVKQcmN87oWO+Ht7LJpx9DpFduuxPxXPiNbsgnsLoOefLiH/9u2i5ar uXOuDG+JdYpktVTIisTaDE6B5tlKjSflbvR+aYaaZ1oWilCWdrCbC0qfF4t8BIl4Q0Sj QdaMpPRnXBgk8CH/yiWE4at3To1wYHabdXqEtt3OljPMpQIdmBoMnrbrua+ITOYWm3FD FrOA0VkjDBjgyNSvNNN8nywyArKij3W7QW599ZUf44bnBrk0nygWGbL/pdMU+yUMwYsB +CiPRskC5PpM+PK13RsjoPNwYjbTJfOw5r46+4PSPpSuRDOrtbCvPubxIAgYvunS8/3b tzOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=iSoOPlvl3yznbzrlaBu9YHjlDX/f/dPL6EjeEi2K2Pg=; b=Q1xHPNuOZAD36UTHb5B3V/CcEgL7CwwlVm0qcKOR4MTp9ykLXOj25lK9gTgvoHVwbs Ymsu68s77A0z443PzY1LCXMcuKjVoUlfS+CqHjrIWJw+8lvntf/GOpPSpT7mcKoXGVA/ 6YKogdD6LoJNn10pxOEOQOs3SRqu/JzKsSIeVAZ6u3GTwDklKWm0JxiIsspF3am/Yf3P gO0yAMLRQzH213wa++cF8rYdaFZniOFhQH9KRTW1mfNaUBL9zLCNseoyDm43U/eIufzn 6dPWnQUTd6KTvI2DK88a8xMkiGXYGYzcJSJG7GrwDai0wy5g7SRSiXQh32Vg72VpWTB3 F+ZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id br21si8309646ejb.62.2019.09.10.19.46.58; Tue, 10 Sep 2019 19:47:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbfIKCnN (ORCPT + 99 others); Tue, 10 Sep 2019 22:43:13 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:51352 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726545AbfIKCnM (ORCPT ); Tue, 10 Sep 2019 22:43:12 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 851BFDE31AF07456DF53; Wed, 11 Sep 2019 10:43:10 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Wed, 11 Sep 2019 10:42:59 +0800 From: Huazhong Tan To: CC: , , , , , Subject: [PATCH V2 net-next 6/7] net: hns3: check NULL pointer before use Date: Wed, 11 Sep 2019 10:40:38 +0800 Message-ID: <1568169639-43658-7-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568169639-43658-1-git-send-email-tanhuazhong@huawei.com> References: <1568169639-43658-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guangbin Huang This patch checks ops->set_default_reset_request whether is NULL before using it in function hns3_slot_reset. Signed-off-by: Guangbin Huang Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 8dbaf36..616cad0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2006,7 +2006,8 @@ static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev) ops = ae_dev->ops; /* request the reset */ - if (ops->reset_event && ops->get_reset_level) { + if (ops->reset_event && ops->get_reset_level && + ops->set_default_reset_request) { if (ae_dev->hw_err_reset_req) { reset_type = ops->get_reset_level(ae_dev, &ae_dev->hw_err_reset_req); -- 2.7.4