Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1462208pxb; Sat, 16 Oct 2021 10:30:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKr6WJv4lO5ncKbhouIIBnX7znEFsjCbVzonr6DBhj7ZZJGhBWV3b3pYTmdbgoDVghrmua X-Received: by 2002:a17:90a:4815:: with SMTP id a21mr21794527pjh.108.1634405441574; Sat, 16 Oct 2021 10:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634405441; cv=none; d=google.com; s=arc-20160816; b=m9mL8/1GNe1vXrJQFVjWf+1tTXAdEpXTGEmLkDW0Dv3y+nODwKos1Op1yGviUQOESz 9Ad6BpXJAnmi9zHhG+h7wvrPvv8wRVwr5aYIdjVugDC5TVHyHsGHQYrJYtLwxUsVJALX 8Ocj8dyDC05GgEntg7/HEND6ZXmLoa7w3UbGHCHgyEF51bXBlME+iS+sFUdYR3pFXojQ GS1VZgFfNCYeASeRKxsYxxzj9W5me41cHon1l8N1aaJr40IcGRUkUvvlLfiYXsU96Y7T KHG8z8SfAub3DFOGgNdziUbDoMB1y73pt/zJVFfQp5nlZeQrJebYYLC+AevDz606/cjW jWxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jZJX9CbLMezPavdAEsrkOsiHPTmHr09QIspE6IFIFVc=; b=Gwo9O4y5hCxbImH4YzaqJS6Epo6O0LEHPI8hyZidYXT3V5MQO+7EmaF9JrnGDsocHi EVlaJIyE3+jInRie/XvrSBczLrB6A71OWWaVoiLwQ+rH9JbHHjle74OAABQiJn9xfWtL 0ieq+ZhDydTGmt6g4ZfMMftxtW/52vYdZ6PDtB9/hF/mCuVJOSE7Jn/VkUT4W0h3vxsN nEhcCmL82scG3kaAuVCGlTKPyXeWSGWnyPv0HnyRliMBKoKSboHJ5W8Pe7m7ltsTzv/I QhfyIVnPSRS9C/iyF0Ziy5AhfGCk0A8Gx+h12K6MEmsba1LSSNIVMpqS4+4tbni6IGoY 9dlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iXTG7Mgr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si14393198pfm.380.2021.10.16.10.30.25; Sat, 16 Oct 2021 10:30:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iXTG7Mgr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240725AbhJOOsH (ORCPT + 99 others); Fri, 15 Oct 2021 10:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235318AbhJOOsH (ORCPT ); Fri, 15 Oct 2021 10:48:07 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEBAC061570; Fri, 15 Oct 2021 07:46:00 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id l6so6526298plh.9; Fri, 15 Oct 2021 07:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jZJX9CbLMezPavdAEsrkOsiHPTmHr09QIspE6IFIFVc=; b=iXTG7MgruvfoISzQMeRGbBt2ad6/7BSmR4i1c1wy+VVD8k+y+QFQjDpVRGodJJARaB rDa5mBuKvLkuaNAjwKzsRKp/jZ9BQCX3vfmu9UO49PwTu4nE3j4cv9boiPNIZnNf4FM5 JcLFF7SwagmeuTdanyYGIqRaR5J9yFyDF8fwB7mDdZ+lR8jk08ccNse8poo8n/XK5kvH Sa7wc7IhrlhwJhRdzMn6SvMGIAwfg27LrzHpI49DK2knMHVg0AMavrixa5bAsmrGNK4+ 4DVqk+mlk721j7YqlN/+l94CASLZG3nsHLorK+dwEOjBIMBiQjsge9pJxrpovAzXUhdM Az/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jZJX9CbLMezPavdAEsrkOsiHPTmHr09QIspE6IFIFVc=; b=67iIKZIKHNUycfYWKtwdsZyi1JtCOBE9hQne2F1THNH+sDb6AFoi/NpRtwPffyGEGR XzMbhgYHka+KTr03uVpCLgameHn+vkgiWRtMaLJIFutYz5EWurkS9InjZRlUQCdEJHFw eXTWAAE4DQ4RtjR2CBGHPfH69tOBTxVEz7m6HjblsXAI6PG9BVqpp9qcqB/4WfkUqRTh lFSlK69pGyjNP4mzb4NE2yOeK9fNFUppptdnU/kzWZUi+sd1MHojDPEpPR2TT2dh4Fmx GUzm3dKDsTZFLb93J6V2nMNyFAW3PcfoCVxQwWvCVBtt3MF9iCAG806311m3CjSz0qFK InNw== X-Gm-Message-State: AOAM530VMeWZ3rTAJlNn7QBYoSEn6REo833gnSQBDYM+lX0Y9XusKhcN 0x357Z1aSwZuIgS2VEqLdVw= X-Received: by 2002:a17:902:6544:b0:13e:dd16:bd5b with SMTP id d4-20020a170902654400b0013edd16bd5bmr11591581pln.61.1634309160465; Fri, 15 Oct 2021 07:46:00 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:4806:9a51:7f4b:9b5c:337a]) by smtp.gmail.com with ESMTPSA id f18sm5293491pfa.60.2021.10.15.07.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:00 -0700 (PDT) From: Naveen Naidu To: bhelgaas@google.com Cc: Naveen Naidu , linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Derrick , Nirmal Patel , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= Subject: [PATCH v2 17/24] PCI: vmd: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:08:58 +0530 Message-Id: <0da4dfe7642bf89d954c7062a40566bf28d94da1.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An MMIO read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. Use RESPONSE_IS_PCI_ERROR() to check the response we get when we read data from hardware. This helps unify PCI error response checking and make error checks consistent and easier to find. Reviewed-by: Jonathan Derrick Signed-off-by: Naveen Naidu --- drivers/pci/controller/vmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index a5987e52700e..db81bc4cfe8c 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -538,7 +538,7 @@ static int vmd_get_phys_offsets(struct vmd_dev *vmd, bool native_hint, int ret; ret = pci_read_config_dword(dev, PCI_REG_VMLOCK, &vmlock); - if (ret || vmlock == ~0) + if (ret || RESPONSE_IS_PCI_ERROR(&vmlock)) return -ENODEV; if (MB2_SHADOW_EN(vmlock)) { -- 2.25.1