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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200721210554.GC5966@amd>
Date:   Tue, 21 Jul 2020 23:05:54 +0200
From:   Pavel Machek <pavel@....cz>
To:     Dan Murphy <dmurphy@...com>
Cc:     jacek.anaszewski@...il.com, robh@...nel.org, marek.behun@....cz,
        devicetree@...r.kernel.org, linux-leds@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v31 03/12] leds: lp50xx: Add the LP50XX family of the RGB
 LED driver

Hi!

> The device has the ability to group LED output into control banks
> so that multiple LED banks can be controlled with the same mixing and
> brightness.  Inversely the LEDs can also be controlled independently.

Inversely?

> --- /dev/null
> +++ b/drivers/leds/leds-lp50xx.c
> @@ -0,0 +1,784 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// TI LP50XX LED chip family driver
> +// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
> +

Can we get https here and in the binding document?

Please run this through checkpatch -- I believe it will have some
comments.

> +
> +	device_for_each_child_node(priv->dev, child) {
> +		led = &priv->leds[i];
> +		ret = fwnode_property_count_u32(child, "reg");
> +		if (ret < 0) {
> +			dev_err(&priv->client->dev,
> +					"reg property is invalid\n");
> +			return -EINVAL;

is handle_put(child) needed here?

> +		}
> +		if (ret > 1) {
> +			priv->num_of_banked_leds = ret;
> +			if (priv->num_of_banked_leds >
> +			    priv->chip_info->max_modules) {
> +				dev_err(&priv->client->dev,
> +					"reg property is invalid\n");
> +				ret = -EINVAL;
> +				fwnode_handle_put(child);
> +				goto child_out;
> +			}
> +
> +			ret = fwnode_property_read_u32_array(child,
> +							     "reg",
> +							     led_banks,
> +							     ret);

Move this to subfunction to reduce the indentation? (Or, just refactor
it somehow).

> +			if (ret) {
> +				dev_err(&priv->client->dev,
> +					"reg property is missing\n");
> +				fwnode_handle_put(child);
> +				goto child_out;
> +			}

Create label that does the handle_put so you don't need to repeat it
quite so often?

> +		fwnode_for_each_child_node(child, led_node) {
> +			ret = fwnode_property_read_u32(led_node, "color",
> +						       &color_id);
> +			if (ret)
> +				dev_err(priv->dev, "Cannot read color\n");
> +
> +			mc_led_info[num_colors].color_index = color_id;

This uses undefined value.

> +	ret = lp50xx_reset(led);

Does the GPIO need to be disabled before enabling it for reset?

Best regards,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ