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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 04 Apr 2014 17:15:35 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Grygorii Strashko <grygorii.strashko@...com>,
	Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org
CC:	davinci-linux-open-source@...ux.davincidsp.com,
	linux-doc@...r.kernel.org, Randy Dunlap <rdunlap@...radead.org>,
	linux-kernel@...r.kernel.org, santosh.shilimkar@...com,
	"David S. Miller" <davem@...emloft.net>,
	Jonathan Cameron <jic23@...nel.org>
Subject: Re: [PATCH 1/2] mdio_bus: implement devm_mdiobus_alloc/devm_mdiobus_free

Hello.

On 04-04-2014 17:40, Grygorii Strashko wrote:

> Add a resource managed devm_mdiobus_alloc()/devm_mdiobus_free()
> to automatically clean up MDIO bus alocations made by MDIO drivers,
> thus leading to simplified MDIO drivers code.

> Signed-off-by: Grygorii Strashko <grygorii.strashko@...com>
[...]

> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 76f54b3..fdcd6d1 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -69,6 +69,74 @@ struct mii_bus *mdiobus_alloc_size(size_t size)
>   }
>   EXPORT_SYMBOL(mdiobus_alloc_size);
>
> +static void _devm_mdiobus_free(struct device *dev, void *res)
> +{
> +	mdiobus_free(*(struct mii_bus **)res);
> +}
> +
> +static int devm_mdiobus_match(struct device *dev, void *res, void *data)
> +{
> +	struct mii_bus **r = res;

    Please insert an empty line after declaration.

> +	if (!r || !*r) {
> +		WARN_ON(!r || !*r);

    Hm, why we need the duplicate check This condition is always true.

[...]
> +/**
> + * devm_mdiobus_free - Resource-managed mdiobus_free()
> + * @dev:		Device this mii_bus belongs to
> + * @bus:		the mii_bus associated with the device
> + *
> + * Free mii_bus allocated with devm_mdiobus_alloc().
> + */
> +void devm_mdiobus_free(struct device *dev, struct mii_bus *bus)
> +{
> +	int rc;
> +
> +	rc = devres_release(dev, _devm_mdiobus_free,
> +		devm_mdiobus_match, bus);

    Please make this line start under 'dev', according to the networking 
coding style.

[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists