lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 6 Sep 2016 13:15:46 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Tomasz Nowicki <tn@...ihalf.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Marc Zyngier <marc.zyngier@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jason Cooper <jason@...edaemon.net>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Bjorn Helgaas <helgaas@...nel.org>,
        Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>,
        Will Deacon <will.deacon@....com>,
        Catalin Marinas <catalin.marinas@....com>,
        Hanjun Guo <hanjun.guo@...aro.org>, shijie.huang@....com,
        robert.richter@...iumnetworks.com, Marcin Wojtas <mw@...ihalf.com>,
        Linux PCI <linux-pci@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linaro-acpi@...ts.linaro.org" <linaro-acpi@...ts.linaro.org>,
        Andrea Gallo <andrea.gallo@...aro.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Al Stone <al.stone@...aro.org>,
        G Gregory <graeme.gregory@...aro.org>,
        David Daney <ddaney.cavm@...il.com>,
        Sinan Kaya <okaya@...eaurora.org>
Subject: Re: [PATCH V9 1/8] ACPI: I/O Remapping Table (IORT) initial support

On Tue, Sep 6, 2016 at 9:24 AM, Tomasz Nowicki <tn@...ihalf.com> wrote:
> Hi Rafael,
>
>
> On 05.09.2016 22:29, Rafael J. Wysocki wrote:
>>
>> On Mon, Sep 5, 2016 at 10:05 PM, Tomasz Nowicki <tn@...ihalf.com> wrote:
>>>

[cut]

> static acpi_status iort_match_node_callback(struct acpi_iort_node *node,
>                                             void *context)
> {
>         struct device *dev = context;
>         acpi_status status = AE_NOT_FOUND;
>
>         switch (node->type) {
>         case ACPI_IORT_NODE_NAMED_COMPONENT: {
>                 struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
>                 struct acpi_device *adev = to_acpi_device_node(dev->fwnode);
>                 struct acpi_iort_named_component *ncomp;
>
>                 if (!adev)
>                         break;
>
>                 status = acpi_get_name(adev->handle, ACPI_FULL_PATHNAME,
> &buf);
>                 if (ACPI_FAILURE(status)) {
>                         dev_warn(dev, "Can't get device full path name\n");
>                         break;
>                 }
>
>                 ncomp = (struct acpi_iort_named_component *)node->node_data;
>                 if (!strcmp(ncomp->device_name, buf.pointer))
>                         status = AE_OK;
>
>                 acpi_os_free(buf.pointer);
>                 break;
>         }
>         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: {
>                 struct acpi_iort_root_complex *pci_rc;
>                 struct pci_bus *bus;
>
>                 bus = to_pci_bus(dev);
>                 pci_rc = (struct acpi_iort_root_complex *)node->node_data;
>
>                 /*
>                  * It is assumed that PCI segment numbers maps one-to-one
>                  * with root complexes. Each segment number can represent
> only
>                  * one root complex.
>                  */
>                 if (pci_rc->pci_segment_number == pci_domain_nr(bus))
>                         status = AE_OK;
>
>                 break;
>         }
>         }
>
>         return status;
> }
>
>>
>>> +               } else {
>>> +                       int match;
>>> +
>>> +                       match = !strcmp(ncomp->device_name,
>>> buffer.pointer);
>>> +                       acpi_os_free(buffer.pointer);
>>> +
>>> +                       if (match)
>>> +                               return AE_OK;
>>> +               }
>>> +
>>> +               break;
>>> +       }
>>> +       case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: {
>>
>>
>> What is the brace for?
>
>
> To create namespace for below local variables. The same for
> ACPI_IORT_NODE_NAMED_COMPONENT case.

This looks weird, though.  At least nest it in a usual way.

And what would be wrong with using if () {} else if () {} instead?

There are two cases only here anyway.

Thanks,
Rafael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ