From patchwork Wed Jan 17 05:22:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 10168507 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B0C8060386 for ; Wed, 17 Jan 2018 05:18:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFB6A251F4 for ; Wed, 17 Jan 2018 05:18:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B34AF27F98; Wed, 17 Jan 2018 05:18:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BC0B27F8E for ; Wed, 17 Jan 2018 05:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750877AbeAQFSx (ORCPT ); Wed, 17 Jan 2018 00:18:53 -0500 Received: from mga09.intel.com ([134.134.136.24]:26207 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751090AbeAQFSx (ORCPT ); Wed, 17 Jan 2018 00:18:53 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2018 21:18:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,371,1511856000"; d="scan'208";a="22263587" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.44]) by fmsmga004.fm.intel.com with ESMTP; 16 Jan 2018 21:18:52 -0800 From: Keith Busch To: linux-pci@vger.kernel.org, Bjorn Helgaas Cc: Maik Broemme , Pawandeep Oza , Sinan Kaya , Keith Busch Subject: [PATCHv2 1/6] PCI/AER: Return correct value when AER is not supported Date: Tue, 16 Jan 2018 22:22:01 -0700 Message-Id: <20180117052206.7703-2-keith.busch@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180117052206.7703-1-keith.busch@intel.com> References: <20180117052206.7703-1-keith.busch@intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Getting the AER information is documented to return 0 when it failed to get the information. If called using a device that does not support AER, it may cause erroneous data to be logged. There should not be a case this currently fails, but this patch is preparing for additional use cases. Signed-off-by: Keith Busch --- drivers/pci/pcie/aer/aerdrv_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 744805232155..ea0dc1cc7fc7 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -660,7 +660,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) /* The device might not support AER */ if (!pos) - return 1; + return 0; if (info->severity == AER_CORRECTABLE) { pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS,