mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-18 20:04:16 +08:00
pcmcia: sa11x0: convert memory allocation to devm_* API
Convert the sa11x0 socket driver memory allocation to use devm_kzalloc() to simplify the cleanup path. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
72010aca55
commit
e33e640ad0
@ -93,7 +93,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
|
|||||||
for (i = 0; i < sinfo->nskt; i++)
|
for (i = 0; i < sinfo->nskt; i++)
|
||||||
soc_pcmcia_remove_one(&sinfo->skt[i]);
|
soc_pcmcia_remove_one(&sinfo->skt[i]);
|
||||||
|
|
||||||
kfree(sinfo);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
|
|||||||
|
|
||||||
sa11xx_drv_pcmcia_ops(ops);
|
sa11xx_drv_pcmcia_ops(ops);
|
||||||
|
|
||||||
sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
|
sinfo = devm_kzalloc(dev, SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
|
||||||
if (!sinfo)
|
if (!sinfo)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -251,7 +251,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
soc_pcmcia_remove_one(&sinfo->skt[i]);
|
soc_pcmcia_remove_one(&sinfo->skt[i]);
|
||||||
kfree(sinfo);
|
|
||||||
} else {
|
} else {
|
||||||
dev_set_drvdata(dev, sinfo);
|
dev_set_drvdata(dev, sinfo);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user