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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 5 Aug 2021 11:21:01 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Jiri Slaby <jirislaby@...nel.org>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Maximilian Luz <luzmaximilian@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Lee Jones <lee.jones@...aro.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Mark Gross <mgross@...ux.intel.com>,
        Rob Herring <robh@...nel.org>
Subject: Re: [PATCH v2 1/2] serdev: Split and export serdev_acpi_get_uart_resource()

On Thu, Aug 5, 2021 at 10:36 AM Jiri Slaby <jirislaby@...nel.org> wrote:
> On 04. 08. 21, 16:29, Andy Shevchenko wrote:

...

> > +/**
> > + * serdev_acpi_get_uart_resource - Gets UARTSerialBus resource if type matches
> > + * @ares:    ACPI resource
> > + * @uart:    Pointer to UARTSerialBus resource will be returned here
> > + *
> > + * Checks if the given ACPI resource is of type UARTSerialBus.
> > + * In this case, returns a pointer to it to the caller.
> > + *
> > + * Returns true if resource type is of UARTSerialBus, otherwise false.
>
> Better to write:
>   * Return: True if resource type is of UARTSerialBus, otherwise false.
> which is recognized by sphinx.

Will fix it in v3.

> > + */

...

> Why don't you return NULL, or sb, thus eliminating the parameter?

1. That's how other similar APIs are done.
2. It will save a line of code in the callers. Usual pattern
  if (...get_res(..., &sb))
   return ERR_or_so;

With your proposal

  sb = get_res(...);
  if (!sb)
    return ERR_or_so;

> > +}

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ