Thread (12 messages) flat view 12 messages, 2 authors, 2014-05-16

Re: [PATCH v2 7/9] net: mvmdio: Use devm_* API to simplify the code

From: Sergei Shtylyov <hidden>
Date: 2014-05-06 18:01:00

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@gmail.com>
Signed-off-by: Ezequiel Garcia <redacted>
---
  drivers/net/ethernet/marvell/mvmdio.c | 18 ++++++------------
  1 file changed, 6 insertions(+), 12 deletions(-)
quoted hunk ↗ jump to hunk
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
[...]
quoted hunk ↗ jump to hunk
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help