Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1379058

Re: [PATCH v2 4/4] ACPI: PCI: Add generic PCI host controller

From Sinan Kaya <okaya@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 4/4] ACPI: PCI: Add generic PCI host controller
Date 2016-04-14 18:00 +0200
Message-ID <rnRQu-4b1-21@gated-at.bofh.it> (permalink)
References <rmSOC-4W8-3@gated-at.bofh.it> <rmSOC-4W8-11@gated-at.bofh.it> <rnRQu-4b1-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 4/14/2016 11:53 AM, Sinan Kaya wrote:
> On 4/11/2016 6:45 PM, Jayachandran C wrote:
>> +/* find the entry in cfgarr which contains range bus_start..bus_end */
>> +static int mcfg_lookup(u16 seg, u8 bus_start, u8 bus_end)
>> +{
>> +	struct pci_config_window *cfg;
>> +	int i;
>> +
>> +	if (!cfgarr)
>> +		return -ENOENT;
>> +
>> +	for (i = 0; cfgarr[i]; i++) {
>> +		cfg = cfgarr[i];
>> +
> 
> I see that you are allocating an array of cfgarr to keep the MCFG table entries.
> The above way of checking the number of entries is not correct. 
> 
> You should keep track of the number of entries you found out globally instead of 
> relying an element being NULL or not. 
> 
> If you exceed the array size, you may or may not be lucky to find another entry
> in memory.
> 

I see now that you are allocating an extra element in memory. Still, looping to find
out the number of elements didn't quite look good to me.

+		for (i = 0; cfgarr[i]; i++)
+			;
+		pr_info(PREFIX " MCFG table at loaded, %d entries\n", i);


-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] ACPI based PCI host driver with generic ECAM Jayachandran C <jchandra@broadcom.com> - 2016-04-12 00:50 +0200
  [PATCH v2 2/4] PCI: Provide common functions for ECAM mapping Jayachandran C <jchandra@broadcom.com> - 2016-04-12 00:50 +0200
    Re: [PATCH v2 2/4] PCI: Provide common functions for ECAM mapping Jon Masters <jcm@jonmasters.org> - 2016-04-12 06:30 +0200
      Re: [PATCH v2 2/4] PCI: Provide common functions for ECAM mapping Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-04-12 18:50 +0200
        Re: [PATCH v2 2/4] PCI: Provide common functions for ECAM mapping Jon Masters <jcm@jonmasters.org> - 2016-04-14 08:30 +0200
          Re: [PATCH v2 2/4] PCI: Provide common functions for ECAM mapping Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-04-14 12:10 +0200
    Re: [PATCH v2 2/4] PCI: Provide common functions for ECAM mapping Jayachandran C <jchandra@broadcom.com> - 2016-04-14 17:50 +0200
  [PATCH v2 4/4] ACPI: PCI: Add generic PCI host controller Jayachandran C <jchandra@broadcom.com> - 2016-04-12 00:50 +0200
    Re: [PATCH v2 4/4] ACPI: PCI: Add generic PCI host controller Sinan Kaya <okaya@codeaurora.org> - 2016-04-14 18:00 +0200
      Re: [PATCH v2 4/4] ACPI: PCI: Add generic PCI host controller Sinan Kaya <okaya@codeaurora.org> - 2016-04-14 18:00 +0200
  [PATCH v2 1/4] arm64: Prepare to use generic ACPI PCI implementation Jayachandran C <jchandra@broadcom.com> - 2016-04-12 00:50 +0200

csiph-web