ARM: at91/tclib: prefer using of devm_* functions
authorGaël PORTAY <gael.portay@gmail.com>
Sat, 6 Sep 2014 17:52:34 +0000 (19:52 +0200)
committerNicolas Ferre <nicolas.ferre@atmel.com>
Mon, 8 Sep 2014 08:54:03 +0000 (10:54 +0200)
Signed-off-by: Gaël PORTAY <gael.portay@gmail.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
drivers/misc/atmel_tclib.c

index c8d8e38d0d8ae6dc47cc0d85b581388896ae5361..b514a2d4485bc6746500f84858442c016bc3e14d 100644 (file)
@@ -150,17 +150,15 @@ static int __init tc_probe(struct platform_device *pdev)
        if (irq < 0)
                return -EINVAL;
 
-       tc = kzalloc(sizeof(struct atmel_tc), GFP_KERNEL);
+       tc = devm_kzalloc(&pdev->dev, sizeof(struct atmel_tc), GFP_KERNEL);
        if (!tc)
                return -ENOMEM;
 
        tc->pdev = pdev;
 
-       clk = clk_get(&pdev->dev, "t0_clk");
-       if (IS_ERR(clk)) {
-               kfree(tc);
-               return -EINVAL;
-       }
+       clk = devm_clk_get(&pdev->dev, "t0_clk");
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
 
        /* Now take SoC information if available */
        if (pdev->dev.of_node) {
@@ -171,10 +169,10 @@ static int __init tc_probe(struct platform_device *pdev)
        }
 
        tc->clk[0] = clk;
-       tc->clk[1] = clk_get(&pdev->dev, "t1_clk");
+       tc->clk[1] = devm_clk_get(&pdev->dev, "t1_clk");
        if (IS_ERR(tc->clk[1]))
                tc->clk[1] = clk;
-       tc->clk[2] = clk_get(&pdev->dev, "t2_clk");
+       tc->clk[2] = devm_clk_get(&pdev->dev, "t2_clk");
        if (IS_ERR(tc->clk[2]))
                tc->clk[2] = clk;