summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-03-26 10:33:16 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-09-03 16:00:38 +0100
commit8e2caf0d21a7059d8b56cb19d5d0182a28b1eabc (patch)
tree8d1e4a40ea40d1e9c46bac5b7134ced2f03738ea /drivers/pcmcia
parentac92f1517379299c03dc501b6a44be49cfcbcfe4 (diff)
downloadlinux-8e2caf0d21a7059d8b56cb19d5d0182a28b1eabc.tar.bz2
pcmcia: pxa2xx: convert memory allocation to devm_* API
Convert the pxa2xx socket driver memory allocation to use devm_kzalloc() to simplify the cleanup path. Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/pxa2xx_base.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 197c77a64ce0..0f42d55e7c7f 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -302,7 +302,8 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
pxa2xx_drv_pcmcia_ops(ops);
- sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
+ sinfo = devm_kzalloc(&dev->dev, SKT_DEV_INFO_SIZE(ops->nr),
+ GFP_KERNEL);
if (!sinfo)
return -ENOMEM;
@@ -330,7 +331,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
err1:
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
- kfree(sinfo);
+
err0:
return ret;
}
@@ -340,12 +341,9 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
struct skt_dev_info *sinfo = platform_get_drvdata(dev);
int i;
- platform_set_drvdata(dev, NULL);
-
for (i = 0; i < sinfo->nskt; i++)
soc_pcmcia_remove_one(&sinfo->skt[i]);
- kfree(sinfo);
return 0;
}