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] [thread-next>] [day] [month] [year] [list]
Message-ID: <53692366.4000600@cogentembedded.com>
Date:	Tue, 06 May 2014 22:01:10 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>,
	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Willy Tarreau <w@....eu>,
	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
CC:	Gregory Clement <gregory.clement@...e-electrons.com>,
	Lior Amsalem <alior@...vell.com>,
	Tawfik Bayouk <tawfik@...vell.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>
Subject: Re: [PATCH v2 7/9] net: mvmdio: Use devm_* API to simplify the code

Hello.

On 05/06/2014 09:20 PM, Ezequiel Garcia wrote:

> This commit makes use of devm_kmalloc() for memory allocation and the
> recently introduced devm_mdiobus_alloc() API to simplify driver's code.
> While here, remove a redundant out of memory error message.

> Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>
> ---
>   drivers/net/ethernet/marvell/mvmdio.c | 18 ++++++------------
>   1 file changed, 6 insertions(+), 12 deletions(-)

> diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
> index b161a52..995e182 100644
> --- a/drivers/net/ethernet/marvell/mvmdio.c
> +++ b/drivers/net/ethernet/marvell/mvmdio.c
[...]
> @@ -208,11 +207,10 @@ static int orion_mdio_probe(struct platform_device *pdev)
>   		 dev_name(&pdev->dev));
>   	bus->parent = &pdev->dev;
>
> -	bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
> -	if (!bus->irq) {
> -		mdiobus_free(bus);
> +	bus->irq = devm_kmalloc(&pdev->dev,
> +				sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);

    I'd rather use devm_kmalloc_array().

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ