Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp721955pxb; Thu, 21 Oct 2021 08:16:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCPFz5NLCbdTkDXEzPFRFk0+0ZnBOHUhUH0YG3aLXa5ecL0jUcftLqMWkwf/S2IPk4NAMQ X-Received: by 2002:a17:90a:718b:: with SMTP id i11mr7596230pjk.22.1634829363780; Thu, 21 Oct 2021 08:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634829363; cv=none; d=google.com; s=arc-20160816; b=Do8Tsf+VcoXexJVrLE1Bldp56zMP+0Vow4ziKcLnrm2trKIQJll0Y/MRCKMyelmCeA zUTFENNZl8n3sGKW6R8lRIv8IhOxTvDeV76pqru5XvuY+s2q/4ld36GA6UleYPSoBUon IQBk3zJccd6mP70j+K72VcEHsXefbnAmPhxajeUcdzptiGyEqXACFp5SrUChoJSBNARF VaOzTUdcyvGPjC3fx2F4r0I4QEYzwUDrfBopHE1yYzU3Rgm/E4k5QaV/WAopWJWhlfrT dzmnbvgsglrCFbjycEC7iL3NMAKXAzkULIw1sD2zuPByOzdUmiQ+xMqCgH5xSsUQpfPY GxLw== 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=nMMca6ogUWXi0ch4Y2WRyLimPI/FUHz8LX6jciCfSL0=; b=zvlbwHJuBWByAl7jaJ9lXurVhIADhrpANUsftnNw+QLFGN6o8Qxqi7Cy6X37c9eLcb UPjg4oFc3rC0b3BrAhp6vPKZTlcthkT/ZTwIL8DE+l/b2/yvvYzKqcfa6XLvXCGY9liZ 4YdcGRL+nNpgdl/h1VImmqES3IYN4b3PX6IkSBqJq3WT4MYaimfm4LTRh1VYrHO65qPJ RYJdySc4lBsAfUqpMCrZrTXf0VTv+nJlt66ZiU8nvBQud4woJ/SUo2xPcnPMmt29UI90 Of24Mo9m5zwpbQu33ZQ8LGKt9DjC0iLPWc5U3FTyyAbxu2zRCslghNoRl0UTH/BgsrDu a+Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ebt87PGC; 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 j15si8975898pfj.24.2021.10.21.08.15.50; Thu, 21 Oct 2021 08:16:03 -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=Ebt87PGC; 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 S232132AbhJUPQq (ORCPT + 99 others); Thu, 21 Oct 2021 11:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232131AbhJUPQX (ORCPT ); Thu, 21 Oct 2021 11:16:23 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A443C0432C5; Thu, 21 Oct 2021 08:13:33 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id y4so673327plb.0; Thu, 21 Oct 2021 08:13:33 -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=nMMca6ogUWXi0ch4Y2WRyLimPI/FUHz8LX6jciCfSL0=; b=Ebt87PGCiA5DfC2ykF3q2FI75oUe+I22DKgpYutQWfZKv6HY11WV3QxfBdoZ2IZ/8R 1dXQQC3ymsHSF7lHENRAW7heU7N3//R7ApODSTy2OPCTm8KgE/AdYPjd7BcjUw/JeXaQ G6d0gMcA5ImCvXHdrbfxenldCzozNVINxVpHzZU2dtq0JEiZYMzTAf6eS7YcNzYATO7a RFkZdTwYgxCgX5Yb7coZ5yE1oIPHu3K+j7/wBKwKhM9Xp01itiWZJ0+Ob03p93IpGsKR d44pWrjLExUCkKCJyqzDEUK0sO+89IQael7QvcRgen995yz6PiWAjLUmDvrkj/EXLhly Mjqw== 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=nMMca6ogUWXi0ch4Y2WRyLimPI/FUHz8LX6jciCfSL0=; b=qd9unDtwHQTHQKsmDNtVbxmg5VQhIxUGej9HhWtAwnoUPmBHYWnTgdPwRfh1bAXIln jt+s0zy/asQsj3yX0ISliJZ+FesfV2t7CssmTNWZWuaw8Uudhh2oRkEUpOjuMaIvD9Hy GfkV8LzHpKVKbN+xw25RMseGVvU4lb/A9pbtHBA4qJLd34FC7wpv1lFxpl6csl27w/Oo a49oiW/V6AeQlBKRiaEMsi/rJszrynu/8FgSinQW68txn0+e7N+7pvpNdN1CdxhyNHIb XXX34qR37f6ymodGaRf/PyCkXbOrJ2DPHVI1kQA+oL3IvU9vKYY2iWUkwD9H3P2LOiK7 Dk7Q== X-Gm-Message-State: AOAM533tju+/LJ+hBpLd/Cf74NXlGIgOZTBhnkNEdiN86VH1LFU2yADq 88ANzi0EHsmbY8pAk6tOF+k= X-Received: by 2002:a17:902:b68b:b0:13a:1239:b8d9 with SMTP id c11-20020a170902b68b00b0013a1239b8d9mr5741580pls.25.1634829212923; Thu, 21 Oct 2021 08:13:32 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:29a4:d874:a949:6890:f95f]) by smtp.gmail.com with ESMTPSA id c9sm5508027pgq.58.2021.10.21.08.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 08:13:32 -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, skhan@linuxfoundation.org, Nirmal Patel , Jonathan Derrick , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= Subject: [PATCH v3 17/25] PCI: vmd: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Thu, 21 Oct 2021 20:37:42 +0530 Message-Id: <5be1fdfdcf4b4a453117ef4dea0f71c9555fac24.1634825082.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. 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..bfe6b002ffec 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