aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/intel_mid_thermal.c
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2014-05-25 03:35:45 -0400
committerMatthew Garrett <matthew.garrett@nebula.com>2014-06-10 19:11:07 -0400
commit14627e36121c90b9a794ab0ea3195efa4c23373e (patch)
treec6e8a60653484bd68f5c2977c99cd6fa10b27ad7 /drivers/platform/x86/intel_mid_thermal.c
parenteec3b959f57508b250831ed10efa07f8209e9d1b (diff)
ix86/mid/thermal: Introduce the use of the managed version of kzalloc
This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. The following Coccinelle semantic patch was used for making the change: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e, e1, e2; @@ probefn(struct platform_device *pdev, ...) { <+... - e = kzalloc(e1, e2) + e = devm_kzalloc(&pdev->dev, e1, e2) ... ?-kfree(e); ...+> } @rem depends on prb@ identifier platform.removefn; expression e; @@ removefn(...) { <... - kfree(e); ...> } Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform/x86/intel_mid_thermal.c')
-rw-r--r--drivers/platform/x86/intel_mid_thermal.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index 93fab8b70ce1..ab7860a21a22 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -481,7 +481,8 @@ static int mid_thermal_probe(struct platform_device *pdev)
481 int i; 481 int i;
482 struct platform_info *pinfo; 482 struct platform_info *pinfo;
483 483
484 pinfo = kzalloc(sizeof(struct platform_info), GFP_KERNEL); 484 pinfo = devm_kzalloc(&pdev->dev, sizeof(struct platform_info),
485 GFP_KERNEL);
485 if (!pinfo) 486 if (!pinfo)
486 return -ENOMEM; 487 return -ENOMEM;
487 488
@@ -489,7 +490,6 @@ static int mid_thermal_probe(struct platform_device *pdev)
489 ret = mid_initialize_adc(&pdev->dev); 490 ret = mid_initialize_adc(&pdev->dev);
490 if (ret) { 491 if (ret) {
491 dev_err(&pdev->dev, "ADC init failed"); 492 dev_err(&pdev->dev, "ADC init failed");
492 kfree(pinfo);
493 return ret; 493 return ret;
494 } 494 }
495 495
@@ -520,7 +520,6 @@ err:
520 thermal_zone_device_unregister(pinfo->tzd[i]); 520 thermal_zone_device_unregister(pinfo->tzd[i]);
521 } 521 }
522 configure_adc(0); 522 configure_adc(0);
523 kfree(pinfo);
524 return ret; 523 return ret;
525} 524}
526 525
@@ -541,8 +540,6 @@ static int mid_thermal_remove(struct platform_device *pdev)
541 thermal_zone_device_unregister(pinfo->tzd[i]); 540 thermal_zone_device_unregister(pinfo->tzd[i]);
542 } 541 }
543 542
544 kfree(pinfo);
545
546 /* Stop the ADC */ 543 /* Stop the ADC */
547 return configure_adc(0); 544 return configure_adc(0);
548} 545}