From patchwork Sun Jul 18 19:36:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12384423 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE,SPF_PASS,T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38FFDC636CB for ; Sun, 18 Jul 2021 19:36:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16CF761181 for ; Sun, 18 Jul 2021 19:36:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230499AbhGRTjt (ORCPT ); Sun, 18 Jul 2021 15:39:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbhGRTjs (ORCPT ); Sun, 18 Jul 2021 15:39:48 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC909C061762 for ; Sun, 18 Jul 2021 12:36:49 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id b12so14384191pfv.6 for ; Sun, 18 Jul 2021 12:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tQCFT/SW7WEYLRMyjRSIWRnYjk78ITEOBogWTZ1e1hI=; b=fYKATZdxqD/94YX5p08BOzOk7+CnX7h+NRd14xzNHS8SxrzKHEgAohf/IKt/AhZgO2 QfZioZGuDKLVWBLTk3iSgPhgB8Y7L8JbWYw+CBeF3l4Axnl9EGfZE7RtrK1+QQeRX7KI ZQKR1cUwdIU8Okzv9ZvkAN6+AL2WOKTunMc40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tQCFT/SW7WEYLRMyjRSIWRnYjk78ITEOBogWTZ1e1hI=; b=qNcWr5tx+QJ8/bRumiJDooypR/adQFYir/HBEB4jygY7cjI8mdH1jbAhmPEkFhT5dP g06rZqqT1FHeJiqj971pcaGoMlp/vOx3Z0RVxC48oAHVQzgzX4fe/DcmlfN59HFcRXId UyOWfQuBI496jyBgwHRIdJH5k3VZEZsIWKIRuECX81OHW4JcLmDy017BJcyP9+EFYXHX ky8FhXRsQYwhETOudVYFwaOvFq0qee7ZmmOV+cAvYuv/tMsXIGv9cn0hX3UutPsGKwEc pi/gYabRA+vPUxTU7vKrHo9Mt9cxL8CLcQsT7fqNXT8fXustvaIpYVmsaprmqhSgUGsy yOFQ== X-Gm-Message-State: AOAM532vICe8cnH5VpYRS43kHXte2aF6HnCpfkr9uCo87tI2rejsscJ8 7Q7aohV7uS6kJ44IYTIBCiQe4A== X-Google-Smtp-Source: ABdhPJy0oZtEZKtnUwZ8PXtW5DCzwu6FsvfTzHaIGhJ0xqC70nCOPRQiOto7PhBXEwtwVRUjLbMGeQ== X-Received: by 2002:aa7:8b4b:0:b029:30c:1be6:b92a with SMTP id i11-20020aa78b4b0000b029030c1be6b92amr21845065pfd.56.1626637008741; Sun, 18 Jul 2021 12:36:48 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 22sm16743648pfo.80.2021.07.18.12.36.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jul 2021 12:36:48 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 1/9] bnxt_en: don't disable an already disabled PCI device Date: Sun, 18 Jul 2021 15:36:25 -0400 Message-Id: <1626636993-31926-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1626636993-31926-1-git-send-email-michael.chan@broadcom.com> References: <1626636993-31926-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Kalesh AP If device is already disabled in reset path and PCI io error is detected before the device could be enabled, driver could call pci_disable_device() for already disabled device. Fix this problem by calling pci_disable_device() only if the device is already enabled. Fixes: 6316ea6db93d ("bnxt_en: Enable AER support.") Signed-off-by: Kalesh AP Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index f56245eeef7b..fdfb75a1608d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -13436,7 +13436,8 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, if (netif_running(netdev)) bnxt_close(netdev); - pci_disable_device(pdev); + if (pci_is_enabled(pdev)) + pci_disable_device(pdev); bnxt_free_ctx_mem(bp); kfree(bp->ctx); bp->ctx = NULL;