drivers/rtc/rtc-vt8500.c: convert to use devm_kzalloc
Replace the kzalloc() and kfree() calls with devm_kzalloc(). Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexey Charkov <alchark@gmail.com> Acked-by: Tony Prisk <linux@prisktech.co.nz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
968d21c2cf
commit
0d7ecb8389
1 changed files with 5 additions and 10 deletions
|
@ -210,7 +210,8 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
|
||||||
struct vt8500_rtc *vt8500_rtc;
|
struct vt8500_rtc *vt8500_rtc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
vt8500_rtc = kzalloc(sizeof(struct vt8500_rtc), GFP_KERNEL);
|
vt8500_rtc = devm_kzalloc(&pdev->dev,
|
||||||
|
sizeof(struct vt8500_rtc), GFP_KERNEL);
|
||||||
if (!vt8500_rtc)
|
if (!vt8500_rtc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -220,15 +221,13 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
|
||||||
vt8500_rtc->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
vt8500_rtc->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (!vt8500_rtc->res) {
|
if (!vt8500_rtc->res) {
|
||||||
dev_err(&pdev->dev, "No I/O memory resource defined\n");
|
dev_err(&pdev->dev, "No I/O memory resource defined\n");
|
||||||
ret = -ENXIO;
|
return -ENXIO;
|
||||||
goto err_free;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vt8500_rtc->irq_alarm = platform_get_irq(pdev, 0);
|
vt8500_rtc->irq_alarm = platform_get_irq(pdev, 0);
|
||||||
if (vt8500_rtc->irq_alarm < 0) {
|
if (vt8500_rtc->irq_alarm < 0) {
|
||||||
dev_err(&pdev->dev, "No alarm IRQ resource defined\n");
|
dev_err(&pdev->dev, "No alarm IRQ resource defined\n");
|
||||||
ret = -ENXIO;
|
return -ENXIO;
|
||||||
goto err_free;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vt8500_rtc->res = request_mem_region(vt8500_rtc->res->start,
|
vt8500_rtc->res = request_mem_region(vt8500_rtc->res->start,
|
||||||
|
@ -236,8 +235,7 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
|
||||||
"vt8500-rtc");
|
"vt8500-rtc");
|
||||||
if (vt8500_rtc->res == NULL) {
|
if (vt8500_rtc->res == NULL) {
|
||||||
dev_err(&pdev->dev, "failed to request I/O memory\n");
|
dev_err(&pdev->dev, "failed to request I/O memory\n");
|
||||||
ret = -EBUSY;
|
return -EBUSY;
|
||||||
goto err_free;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vt8500_rtc->regbase = ioremap(vt8500_rtc->res->start,
|
vt8500_rtc->regbase = ioremap(vt8500_rtc->res->start,
|
||||||
|
@ -278,8 +276,6 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
|
||||||
err_release:
|
err_release:
|
||||||
release_mem_region(vt8500_rtc->res->start,
|
release_mem_region(vt8500_rtc->res->start,
|
||||||
resource_size(vt8500_rtc->res));
|
resource_size(vt8500_rtc->res));
|
||||||
err_free:
|
|
||||||
kfree(vt8500_rtc);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +293,6 @@ static int __devexit vt8500_rtc_remove(struct platform_device *pdev)
|
||||||
release_mem_region(vt8500_rtc->res->start,
|
release_mem_region(vt8500_rtc->res->start,
|
||||||
resource_size(vt8500_rtc->res));
|
resource_size(vt8500_rtc->res));
|
||||||
|
|
||||||
kfree(vt8500_rtc);
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue