From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
Willy Tarreau <w@1wt.eu>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jason Cooper <jason@lakedaemon.net>,
Gregory Clement <gregory.clement@free-electrons.com>,
Andrew Lunn <andrew@lunn.ch>, Tawfik Bayouk <tawfik@marvell.com>,
Lior Amsalem <alior@marvell.com>
Subject: Re: [PATCH 7/7] net: mvmdio: Use devm_* API to simplify the code
Date: Sun, 04 May 2014 23:24:15 +0200 [thread overview]
Message-ID: <5366AFFF.8090205@gmail.com> (raw)
In-Reply-To: <1399141622-30654-8-git-send-email-ezequiel.garcia@free-electrons.com>
On 05/03/2014 08:27 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.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Thanks!
> ---
> 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
> @@ -195,11 +195,10 @@ static int orion_mdio_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> - bus = mdiobus_alloc_size(sizeof(struct orion_mdio_dev));
> - if (!bus) {
> - dev_err(&pdev->dev, "Cannot allocate MDIO bus\n");
> + bus = devm_mdiobus_alloc_size(&pdev->dev,
> + sizeof(struct orion_mdio_dev));
> + if (!bus)
> return -ENOMEM;
> - }
>
> bus->name = "orion_mdio_bus";
> bus->read = orion_mdio_read;
> @@ -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);
> + if (!bus->irq)
> return -ENOMEM;
> - }
>
> for (i = 0; i < PHY_MAX_ADDR; i++)
> bus->irq[i] = PHY_POLL;
> @@ -261,8 +259,6 @@ static int orion_mdio_probe(struct platform_device *pdev)
> out_mdio:
> if (!IS_ERR(dev->clk))
> clk_disable_unprepare(dev->clk);
> - kfree(bus->irq);
> - mdiobus_free(bus);
> return ret;
> }
>
> @@ -273,8 +269,6 @@ static int orion_mdio_remove(struct platform_device *pdev)
>
> writel(0, dev->regs + MVMDIO_ERR_INT_MASK);
> mdiobus_unregister(bus);
> - kfree(bus->irq);
> - mdiobus_free(bus);
> if (!IS_ERR(dev->clk))
> clk_disable_unprepare(dev->clk);
>
>
prev parent reply other threads:[~2014-05-04 21:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-03 18:26 [PATCH 0/7] net: ethernet: marvell: Assorted fixes Ezequiel Garcia
2014-05-03 18:26 ` [PATCH 1/7] net: mv643xx_eth: Simplify mv643xx_eth_adjust_link() Ezequiel Garcia
2014-05-04 21:23 ` Sebastian Hesselbarth
2014-05-05 19:40 ` David Miller
2014-05-06 16:17 ` Ezequiel Garcia
2014-05-03 18:26 ` [PATCH 2/7] net: mvneta: Clean-up mvneta_tx_frag_process() Ezequiel Garcia
2014-05-03 18:26 ` [PATCH 3/7] net: mvneta: Check tx queue setup error in mvneta_change_mtu() Ezequiel Garcia
2014-05-03 18:26 ` [PATCH 4/7] net: mvneta: Clean-up mvneta_init() Ezequiel Garcia
2014-05-03 18:27 ` [PATCH 5/7] net: mvneta: Use prepare/commit API to simplify MAC address setting Ezequiel Garcia
2014-05-03 18:27 ` [PATCH 6/7] net: mvneta: Change the number of default rx queues to one Ezequiel Garcia
2014-05-03 18:27 ` [PATCH 7/7] net: mvmdio: Use devm_* API to simplify the code Ezequiel Garcia
2014-05-04 21:24 ` Sebastian Hesselbarth [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5366AFFF.8090205@gmail.com \
--to=sebastian.hesselbarth@gmail.com \
--cc=alior@marvell.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=ezequiel.garcia@free-electrons.com \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=tawfik@marvell.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).