aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab8500-debugfs.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-23 11:25:05 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 06:11:40 -0400
commitc18cf6d1b0d871745709e4273dc2dfa05376d13b (patch)
treed2aaa52cc857f0049598a7143591db1853138988 /drivers/mfd/ab8500-debugfs.c
parent5feac05dd4a403b12e8e0212006bad5c52e36fba (diff)
mfd: ab8500-debug: 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>
Diffstat (limited to 'drivers/mfd/ab8500-debugfs.c')
-rw-r--r--drivers/mfd/ab8500-debugfs.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index 11656c2c63cb..7d1f1b08fc4b 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -2937,7 +2937,6 @@ static struct dentry *ab8500_gpadc_dir;
2937static int ab8500_debug_probe(struct platform_device *plf) 2937static int ab8500_debug_probe(struct platform_device *plf)
2938{ 2938{
2939 struct dentry *file; 2939 struct dentry *file;
2940 int ret = -ENOMEM;
2941 struct ab8500 *ab8500; 2940 struct ab8500 *ab8500;
2942 struct resource *res; 2941 struct resource *res;
2943 debug_bank = AB8500_MISC; 2942 debug_bank = AB8500_MISC;
@@ -2946,24 +2945,26 @@ static int ab8500_debug_probe(struct platform_device *plf)
2946 ab8500 = dev_get_drvdata(plf->dev.parent); 2945 ab8500 = dev_get_drvdata(plf->dev.parent);
2947 num_irqs = ab8500->mask_size; 2946 num_irqs = ab8500->mask_size;
2948 2947
2949 irq_count = kzalloc(sizeof(*irq_count)*num_irqs, GFP_KERNEL); 2948 irq_count = devm_kzalloc(&plf->dev,
2949 sizeof(*irq_count)*num_irqs, GFP_KERNEL);
2950 if (!irq_count) 2950 if (!irq_count)
2951 return -ENOMEM; 2951 return -ENOMEM;
2952 2952
2953 dev_attr = kzalloc(sizeof(*dev_attr)*num_irqs,GFP_KERNEL); 2953 dev_attr = devm_kzalloc(&plf->dev,
2954 sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
2954 if (!dev_attr) 2955 if (!dev_attr)
2955 goto out_freeirq_count; 2956 return -ENOMEM;
2956 2957
2957 event_name = kzalloc(sizeof(*event_name)*num_irqs, GFP_KERNEL); 2958 event_name = devm_kzalloc(&plf->dev,
2959 sizeof(*event_name)*num_irqs, GFP_KERNEL);
2958 if (!event_name) 2960 if (!event_name)
2959 goto out_freedev_attr; 2961 return -ENOMEM;
2960 2962
2961 res = platform_get_resource_byname(plf, 0, "IRQ_AB8500"); 2963 res = platform_get_resource_byname(plf, 0, "IRQ_AB8500");
2962 if (!res) { 2964 if (!res) {
2963 dev_err(&plf->dev, "AB8500 irq not found, err %d\n", 2965 dev_err(&plf->dev, "AB8500 irq not found, err %d\n",
2964 irq_first); 2966 irq_first);
2965 ret = -ENXIO; 2967 return ENXIO;
2966 goto out_freeevent_name;
2967 } 2968 }
2968 irq_ab8500 = res->start; 2969 irq_ab8500 = res->start;
2969 2970
@@ -2971,16 +2972,14 @@ static int ab8500_debug_probe(struct platform_device *plf)
2971 if (irq_first < 0) { 2972 if (irq_first < 0) {
2972 dev_err(&plf->dev, "First irq not found, err %d\n", 2973 dev_err(&plf->dev, "First irq not found, err %d\n",
2973 irq_first); 2974 irq_first);
2974 ret = irq_first; 2975 return irq_first;
2975 goto out_freeevent_name;
2976 } 2976 }
2977 2977
2978 irq_last = platform_get_irq_byname(plf, "IRQ_LAST"); 2978 irq_last = platform_get_irq_byname(plf, "IRQ_LAST");
2979 if (irq_last < 0) { 2979 if (irq_last < 0) {
2980 dev_err(&plf->dev, "Last irq not found, err %d\n", 2980 dev_err(&plf->dev, "Last irq not found, err %d\n",
2981 irq_last); 2981 irq_last);
2982 ret = irq_last; 2982 return irq_last;
2983 goto out_freeevent_name;
2984 } 2983 }
2985 2984
2986 ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL); 2985 ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL);
@@ -3189,22 +3188,13 @@ err:
3189 if (ab8500_dir) 3188 if (ab8500_dir)
3190 debugfs_remove_recursive(ab8500_dir); 3189 debugfs_remove_recursive(ab8500_dir);
3191 dev_err(&plf->dev, "failed to create debugfs entries.\n"); 3190 dev_err(&plf->dev, "failed to create debugfs entries.\n");
3192out_freeevent_name:
3193 kfree(event_name);
3194out_freedev_attr:
3195 kfree(dev_attr);
3196out_freeirq_count:
3197 kfree(irq_count);
3198 3191
3199 return ret; 3192 return -ENOMEM;
3200} 3193}
3201 3194
3202static int ab8500_debug_remove(struct platform_device *plf) 3195static int ab8500_debug_remove(struct platform_device *plf)
3203{ 3196{
3204 debugfs_remove_recursive(ab8500_dir); 3197 debugfs_remove_recursive(ab8500_dir);
3205 kfree(event_name);
3206 kfree(dev_attr);
3207 kfree(irq_count);
3208 3198
3209 return 0; 3199 return 0;
3210} 3200}