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]
Message-ID: <Pine.LNX.4.44L0.1504021005390.1576-100000@iolanthe.rowland.org>
Date:	Thu, 2 Apr 2015 10:21:46 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Arun Ramamurthy <arun.ramamurthy@...adcom.com>
cc:	Kishon Vijay Abraham I <kishon@...com>,
	Tony Prisk <linux@...sktech.co.nz>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Arnd Bergmann <arnd@...db.de>, <linux-kernel@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>,
	<linux-usb@...r.kernel.org>, Dmitry Torokhov <dtor@...gle.com>,
	Anatol Pomazau <anatol@...gle.com>,
	Jonathan Richardson <jonathar@...adcom.com>,
	Scott Branden <sbranden@...adcom.com>,
	Ray Jui <rjui@...adcom.com>,
	<bcm-kernel-feedback-list@...adcom.com>
Subject: Re: [PATCH v1 2/3] usb: ehci-platform: Use devm_of_phy_get_by_index

On Wed, 1 Apr 2015, Arun Ramamurthy wrote:

> Getting phys by index instead of phy names so that we do
> not have to create a naming scheme when multiple phys
> are present
> 
> Signed-off-by: Arun Ramamurthy <arun.ramamurthy@...adcom.com>
> Reviewed-by: Ray Jui <rjui@...adcom.com>
> Reviewed-by: Scott Branden <sbranden@...adcom.com>


> @@ -204,36 +197,23 @@ static int ehci_platform_probe(struct platform_device *dev)
>  
>  		priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
>  				"phys", "#phy-cells");
> -		priv->num_phys = priv->num_phys > 0 ? priv->num_phys : 1;
>  
> -		priv->phys = devm_kcalloc(&dev->dev, priv->num_phys,
> -				sizeof(struct phy *), GFP_KERNEL);
> -		if (!priv->phys)
> -			return -ENOMEM;
> +		if (priv->num_phys > 0) {
> +			priv->phys = devm_kcalloc(&dev->dev, priv->num_phys,
> +					    sizeof(struct phy *), GFP_KERNEL);
> +			if (!priv->phys)
> +				return -ENOMEM;
> +		} else
> +			priv->num_phys = 0;

This last line isn't needed.  A negative value for priv->num_phys will
work just as well as 0.

> +			priv->phys[phy_num] = devm_of_phy_get_by_index(&dev->dev
> +						, dev->dev.of_node
> +						, phy_num);

What's with the funny placement of the commas?  Are you trying to avoid 
breaking the 80-column rule?  It should look like this:

			priv->phys[phy_num] = devm_of_phy_get_by_index(
					&dev->dev, dev->dev.of_node, phy_num);

When you fix this, you can add:

Acked-by: Alan Stern <stern@...land.harvard.edu>

The same comments apply to your 3/3 patch.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ