diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-05-23 11:25:09 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-13 06:11:41 -0400 |
commit | 1cee87fdf1f8b99585891e7defa1d08fef3c1451 (patch) | |
tree | 5b555229e3661ada7bdd27921d669356df70eff6 | |
parent | 76ba0b896bed38f7be13682a0170074a5235f1be (diff) |
mfd: asic3: Convert to managed resources for allocating memory
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/asic3.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 1b15986c01e1..9532f749412f 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -958,7 +958,8 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
958 | unsigned long clksel; | 958 | unsigned long clksel; |
959 | int ret = 0; | 959 | int ret = 0; |
960 | 960 | ||
961 | asic = kzalloc(sizeof(struct asic3), GFP_KERNEL); | 961 | asic = devm_kzalloc(&pdev->dev, |
962 | sizeof(struct asic3), GFP_KERNEL); | ||
962 | if (asic == NULL) { | 963 | if (asic == NULL) { |
963 | printk(KERN_ERR "kzalloc failed\n"); | 964 | printk(KERN_ERR "kzalloc failed\n"); |
964 | return -ENOMEM; | 965 | return -ENOMEM; |
@@ -970,16 +971,14 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
970 | 971 | ||
971 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 972 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
972 | if (!mem) { | 973 | if (!mem) { |
973 | ret = -ENOMEM; | ||
974 | dev_err(asic->dev, "no MEM resource\n"); | 974 | dev_err(asic->dev, "no MEM resource\n"); |
975 | goto out_free; | 975 | return -ENOMEM; |
976 | } | 976 | } |
977 | 977 | ||
978 | asic->mapping = ioremap(mem->start, resource_size(mem)); | 978 | asic->mapping = ioremap(mem->start, resource_size(mem)); |
979 | if (!asic->mapping) { | 979 | if (!asic->mapping) { |
980 | ret = -ENOMEM; | ||
981 | dev_err(asic->dev, "Couldn't ioremap\n"); | 980 | dev_err(asic->dev, "Couldn't ioremap\n"); |
982 | goto out_free; | 981 | return -ENOMEM; |
983 | } | 982 | } |
984 | 983 | ||
985 | asic->irq_base = pdata->irq_base; | 984 | asic->irq_base = pdata->irq_base; |
@@ -1033,9 +1032,6 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
1033 | out_unmap: | 1032 | out_unmap: |
1034 | iounmap(asic->mapping); | 1033 | iounmap(asic->mapping); |
1035 | 1034 | ||
1036 | out_free: | ||
1037 | kfree(asic); | ||
1038 | |||
1039 | return ret; | 1035 | return ret; |
1040 | } | 1036 | } |
1041 | 1037 | ||
@@ -1058,8 +1054,6 @@ static int asic3_remove(struct platform_device *pdev) | |||
1058 | 1054 | ||
1059 | iounmap(asic->mapping); | 1055 | iounmap(asic->mapping); |
1060 | 1056 | ||
1061 | kfree(asic); | ||
1062 | |||
1063 | return 0; | 1057 | return 0; |
1064 | } | 1058 | } |
1065 | 1059 | ||