Skip to content

Commit

Permalink
ARM: at91/tclib: prefer using of devm_* functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gaël PORTAY authored and Nicolas Ferre committed Sep 8, 2014
1 parent 2626063 commit 8495497
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/misc/atmel_tclib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;

Expand Down

0 comments on commit 8495497

Please sign in to comment.