Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp509572pxj; Wed, 2 Jun 2021 04:58:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzumD6rex7Bq5KtiOz+6EtVLAGyxyk11xShF9uHvdR2GikX12H9DuT6F339enBaUJg/PscE X-Received: by 2002:a17:906:9455:: with SMTP id z21mr12183775ejx.491.1622635128214; Wed, 02 Jun 2021 04:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622635128; cv=none; d=google.com; s=arc-20160816; b=hYWmm7iVk5TAYMBmy4tfP1LWDgzPz3J4PCz/YZJxJlyEViW+KLr29+y93YsHNseVkX aa5fNKpJ9fooElFVYTbt6xr7xOFQoO06MrNiJ32WfpObhmTvFx3hIVi42UKigyMhmi77 o3B7E0we601H+yeZFEVDSlcLjYI+xwRqRBPtbg87drRVyLjQPKVO6pYR/mgBANTz0ctL P/BA0u4gw9oOnnxkXQtmsF5Evan/jyWcYkmRb1+Iyy2nJ/7mM0Wfk1UN8ZmPTnEgoqcu NgBqmzsXi6m92NfNacy/oHKteK8Qq+LXspZdJ8iLCakvtRcq+1H1y7HnQmDLzGjMpxgA IynQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=vf0+jsnxWv3MUeSQuUrF48fJEizrZe94s4fGa0z+Wtc=; b=mFndtjODV4ZHWLjdeqMuWhDBxZQlpSZA4AuA5qm+6TM3rfWcruiMR4LcKjDeVSaMQz Vh8frI4odnHwWLD7BE+HN9humXXS5PXIf1WVyUB3Fy/lxLGHcZjVFXeN+G6Hkom0ly4V 3HJOQpgMQjFwGBRYke3aJnxhZLDvUgkUntpSUC7ezAy5vsCPHG2TqxDSn1JZ1TfBeEQ6 mSErN1Z74++5RBQe0bRLU1jV3lhdaU5da/iTI0AgTIUZhLXMg1Asn3pppvpCHXfxnW1y zqUTnRw8LVf1EwVOKlrZxiKgIMuxdhzTuj3sxz5hfGokf1Ae4vgGmw3evJrbxoIbCJD2 62XA== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh9si20553961ejb.589.2021.06.02.04.58.25; Wed, 02 Jun 2021 04:58:48 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232835AbhFBKdy (ORCPT + 99 others); Wed, 2 Jun 2021 06:33:54 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]:36717 "EHLO mail-wm1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232695AbhFBKdx (ORCPT ); Wed, 2 Jun 2021 06:33:53 -0400 Received: by mail-wm1-f52.google.com with SMTP id n17-20020a7bc5d10000b0290169edfadac9so3454948wmk.1; Wed, 02 Jun 2021 03:32:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vf0+jsnxWv3MUeSQuUrF48fJEizrZe94s4fGa0z+Wtc=; b=pSd+V3KFdbCrUfkQEHXvaEMl/9UX8evR0uMSCMfoyTX9KDNOlqnj+Te9TFlXCfuqbU dDAzv1J1s1t4HDhrJPV6fU1LdIhwDMlgOj9uAggQ9Bw5TR9VIc515LF4Ui4sPxOOio8i Utg5e9UN+M7sIOSGt7duqDf1dQalPVUFFmjDBhHBx2bt1PfUKI2sV2schBKA4OPl9+4R OrHSrHleLIwmHGh0TLasLRfHs54wkprWXCCyHfXbqD5hiCdDMrJrEQaZ8j6xhBGascr/ Jtl+Tzxs68ncrwSl9CUEJgmwH/txz6z9s9Sh/k7fuznbHxsjmOmW9/xcoofcC457vffY pdbA== X-Gm-Message-State: AOAM532rT9y3J1cF7ix489bmkUcdpFVdsB8vw1PNuGPSqt8/DmD/lcYW 7zmW6IuMYINUupoVf4eM0sw= X-Received: by 2002:a7b:cd9a:: with SMTP id y26mr4532738wmj.133.1622629928760; Wed, 02 Jun 2021 03:32:08 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id o17sm5874932wrp.47.2021.06.02.03.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 03:32:08 -0700 (PDT) Date: Wed, 2 Jun 2021 10:32:06 +0000 From: Wei Liu To: Haiyang Zhang Cc: bhelgaas@google.com, lorenzo.pieralisi@arm.com, wei.liu@kernel.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, kys@microsoft.com, olaf@aepfle.de, vkuznets@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pci-hyperv: Add check for hyperv_initialized in init_hv_pci_drv() Message-ID: <20210602103206.4nx55xsl3nxqt6zj@liuwe-devbox-debian-v2> References: <1621984653-1210-1-git-send-email-haiyangz@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1621984653-1210-1-git-send-email-haiyangz@microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 04:17:33PM -0700, Haiyang Zhang wrote: > Add check for hv_is_hyperv_initialized() at the top of init_hv_pci_drv(), > so if the pci-hyperv driver is force-loaded on non Hyper-V platforms, the > init_hv_pci_drv() will exit immediately, without any side effects, like > assignments to hvpci_block_ops, etc. > > Signed-off-by: Haiyang Zhang > Reported-and-tested-by: Mohammad Alqayeem Hello PCI subsystem maintainers, are you going to take this patch or shall I? Wei. > --- > drivers/pci/controller/pci-hyperv.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c > index 6511648271b2..bebe3eeebc4e 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -3476,6 +3476,9 @@ static void __exit exit_hv_pci_drv(void) > > static int __init init_hv_pci_drv(void) > { > + if (!hv_is_hyperv_initialized()) > + return -ENODEV; > + > /* Set the invalid domain number's bit, so it will not be used */ > set_bit(HVPCI_DOM_INVALID, hvpci_dom_map); > > -- > 2.25.1 >