diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-30 22:48:32 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-04-02 11:11:40 +0100 |
commit | 2a25af8ff5a2d077d25dda8f2ee49ddac572dc07 (patch) | |
tree | 9f1e31b34a89645e2ef15d44af37299666e5f2bc /arch/arm/mach-sa1100/neponset.c | |
parent | 44df9479dfcc44b3b367c041d8b78c23244c1658 (diff) |
ARM: sa1100/neponset: convert to devm_kzalloc()
Use the device managed devm_kzalloc() to allocate the neponset device
private memory rather than manually allocating and freeing the data.
This simplifies the cleanup handling a little.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100/neponset.c')
-rw-r--r-- | arch/arm/mach-sa1100/neponset.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c index 0718c9c4fb0a..603479594b19 100644 --- a/arch/arm/mach-sa1100/neponset.c +++ b/arch/arm/mach-sa1100/neponset.c @@ -319,20 +319,20 @@ static int neponset_probe(struct platform_device *dev) irq = ret = platform_get_irq(dev, 0); if (ret < 0) - goto err_alloc; + goto err; nep_res = platform_get_resource(dev, IORESOURCE_MEM, 0); smc91x_res = platform_get_resource(dev, IORESOURCE_MEM, 1); sa1111_res = platform_get_resource(dev, IORESOURCE_MEM, 2); if (!nep_res || !smc91x_res || !sa1111_res) { ret = -ENXIO; - goto err_alloc; + goto err; } - d = kzalloc(sizeof(*d), GFP_KERNEL); + d = devm_kzalloc(&dev->dev, sizeof(*d), GFP_KERNEL); if (!d) { ret = -ENOMEM; - goto err_alloc; + goto err; } d->dev = &dev->dev; @@ -340,7 +340,7 @@ static int neponset_probe(struct platform_device *dev) d->base = ioremap(nep_res->start, SZ_4K); if (!d->base) { ret = -ENOMEM; - goto err_ioremap; + goto err; } if (readb_relaxed(d->base + WHOAMI) != 0x11) { @@ -409,9 +409,7 @@ static int neponset_probe(struct platform_device *dev) err_irq_alloc: err_id: iounmap(d->base); - err_ioremap: - kfree(d); - err_alloc: + err: return ret; } @@ -436,7 +434,6 @@ static int neponset_remove(struct platform_device *dev) irq_free_descs(d->irq_base, NEP_IRQ_NR); nep = NULL; iounmap(d->base); - kfree(d); return 0; } |