net: hns3: add a check for get_reset_level
authorGuangbin Huang <huangguangbin@huawei.com>
Mon, 29 Jul 2019 02:53:23 +0000 (10:53 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Jul 2019 15:23:40 +0000 (08:23 -0700)
For some cases, ops->get_reset_level may not be implemented, so we
should check whether it is NULL before calling get_reset_level.

Signed-off-by: Guangbin Huang <huangguangbin@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index 08af782f70b58bdd72e947750111a36b1182096c..4d58c538fe9c779360321a2ae2a8b37405352b07 100644 (file)
@@ -1963,7 +1963,7 @@ static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev)
 
        ops = ae_dev->ops;
        /* request the reset */
-       if (ops->reset_event) {
+       if (ops->reset_event && ops->get_reset_level) {
                if (ae_dev->hw_err_reset_req) {
                        reset_type = ops->get_reset_level(ae_dev,
                                                &ae_dev->hw_err_reset_req);