[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210811153619.88922-4-boqun.feng@gmail.com>
Date: Wed, 11 Aug 2021 23:36:17 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
Cc: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
Rob Herring <robh@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Boqun Feng <boqun.feng@...il.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-hyperv@...r.kernel.org,
Sunil Muthuswamy <sunilmut@...rosoft.com>,
Marc Zyngier <maz@...nel.org>, Arnd Bergmann <arnd@...db.de>
Subject: [RFC 3/5] PCI: hv: Set NULL as the ACPI device for the PCI host bridge
A PCI host bridge of Hyper-V doesn't have the corresponding ACPI device,
therefore a NULL pointer needs to be set as the ->private of
pci_host_bridge since for platforms with ACPI ->private is used to store
the ACPI device information for the host bridges.
And since kzalloc() is used to allocate pci_host_bridge, as a result,
what is needed is just setting the correct size of ->private, kzalloc()
will zero the field as if set a NULL pointer to it.
Signed-off-by: Boqun Feng <boqun.feng@...il.com>
---
drivers/pci/controller/pci-hyperv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 62dbe98d1fe1..fd3792b5edcc 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -3021,7 +3021,12 @@ static int hv_pci_probe(struct hv_device *hdev,
*/
BUILD_BUG_ON(sizeof(*hbus) > HV_HYP_PAGE_SIZE);
- bridge = devm_pci_alloc_host_bridge(&hdev->device, 0);
+ /*
+ * devm_pci_alloc_host_bridge() use kzalloc(), and we want to set
+ * ->private as a NULL pointer, therefore no need to set ->private after
+ * allocation.
+ */
+ bridge = devm_pci_alloc_host_bridge(&hdev->device, sizeof(struct acpi_device *));
if (!bridge)
return -ENOMEM;
--
2.32.0
Powered by blists - more mailing lists