blob: a3ce8321252c3fab800006211bff00823108a6e0 [file] [log] [blame]
From 071883f24a6f77907bf8fbc8158b6ea7711b1c9f Mon Sep 17 00:00:00 2001
From: Tyrel Datwyler <>
Date: Sun, 10 Nov 2019 23:21:31 -0600
Subject: [PATCH] PCI: rpaphp: Fix up pointer to first drc-info entry
commit 9723c25f99aff0451cfe6392e1b9fdd99d0bf9f0 upstream.
The first entry of the ibm,drc-info property is an int encoded count
of the number of drc-info entries that follow. The "value" pointer
returned by of_prop_next_u32() is still pointing at the this value
when we call of_read_drc_info_cell(), but the helper function
expects that value to be pointing at the first element of an entry.
Fix up by incrementing the "value" pointer to point at the first
element of the first drc-info entry prior.
Signed-off-by: Tyrel Datwyler <>
Acked-by: Bjorn Helgaas <>
Signed-off-by: Michael Ellerman <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index c3899ee1db99..6499c463204e 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -239,6 +239,8 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
value = of_prop_next_u32(info, NULL, &entries);
if (!value)
return -EINVAL;
+ else
+ value++;
for (j = 0; j < entries; j++) {
of_read_drc_info_cell(&info, &value, &drc);