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  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:   Wed, 9 Jan 2019 15:03:51 +0100
From:   Krzysztof Kozlowski <krzk@...nel.org>
To:     Pavel Machek <pavel@....cz>
Cc:     Jacek Anaszewski <jacek.anaszewski@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v6 2/5] leds: Add helper for getting default pattern from
 Device Tree

On Mon, 7 Jan 2019 at 18:49, Pavel Machek <pavel@....cz> wrote:
>
> Hi!
>
> > Multiple LED triggers might need to access default pattern so add a
> > helper for that.
> >
> >  }
> >  EXPORT_SYMBOL_GPL(led_update_brightness);
> >
> > +u32 *led_get_default_pattern(struct led_classdev *led_cdev, unsigned int *size)
> > +{
> > +     struct device_node *np = dev_of_node(led_cdev->dev);
> > +     u32 *pattern;
> > +     int count;
> > +
> > +     if (!np)
> > +             return NULL;
> > +
> > +     count = of_property_count_u32_elems(np, "led-pattern");
> > +     if (count < 0)
> > +             return NULL;
> > +
> > +     pattern = kcalloc(count, sizeof(*pattern), GFP_KERNEL);
> > +     if (!pattern)
> > +             return NULL;
> > +
> > +     if (of_property_read_u32_array(np, "led-pattern", pattern, count))
> > +             goto err;
>
> Just kfree and return here. No need for goto if that is just one case.

OK

>
>
> >  /**
> > + * led_get_default_pattern - return default pattern
> > + *
> > + * @led_cdev: the LED to get default pattern for
> > + * @size:     pointer for storing the number of elements in returned array,
> > + *            modified only if return != NULL
> > + *
> > + * Return:    Allocated array of integers with default pattern from DeviceTree
> > + *            or NULL.  Caller is responsible for kfree().
> > + */
>
> "DeviceTree" -> "device tree".

Sure, thanks for the feedback!

Best regards,
Krzysztof

Powered by blists - more mailing lists