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>
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;
err1:
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
- kfree(sinfo);
+
err0:
return ret;
}
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;
}