lkml.org 
[lkml]   [2012]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [lm-sensors] [PATCH 02/03] HWMON: HWMON driver for DA9052/53 PMIC v3
From
Date
Hi Durga,

On Fri, 2012-03-02 at 11:44 -0500, R, Durgadoss wrote:
> Hi,
>
> > -----Original Message-----
> > From: lm-sensors-bounces@lm-sensors.org [mailto:lm-sensors-bounces@lm-
> > sensors.org] On Behalf Of Ashish Jangam
> > Sent: Friday, March 02, 2012 7:59 PM
> > To: Guenter Roeck
> > Cc: randy.dunlap@oracle.com; linaro-dev@lists.linaro.org;
> > sameo@linux.intel.com; linux-kernel@vger.kernel.org; lm-sensors@lm-sensors.org;
> > dchen@diasemi.com
> > Subject: [lm-sensors] [PATCH 02/03] HWMON: HWMON driver for DA9052/53 PMIC v3
> >
> > The DA9052 PMIC provides an Analogue to Digital Converter with 10 bits
> > resolution and 10 channels.
> >
> > This patch monitors the DA9052 PMIC's ADC channels mostly for battery
> > parameters like battery temperature, junction temperature, battery
> > current etc.
> >
> > This patch is functionally tested on Samsung SMDKV6410
> >
> > Signed-off-by: David Dajun Chen <dchen@diasemi.com>
> > Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com>

[ ... ]

> > +static int __init da9052_hwmon_probe(struct platform_device *pdev)
> > +{
> > + struct da9052_hwmon *hwmon;
> > + int ret;
> > +
> > + hwmon = devm_kzalloc(&pdev->dev, sizeof(struct da9052_hwmon),
> > + GFP_KERNEL);
> > + if (!hwmon)
> > + return -ENOMEM;
> > +
> > + mutex_init(&hwmon->hwmon_lock);
> > + hwmon->da9052 = dev_get_drvdata(pdev->dev.parent);
> > +
> > + platform_set_drvdata(pdev, hwmon);
> > +
> > + ret = sysfs_create_group(&pdev->dev.kobj, &da9052_attr_group);
> > + if (ret)
> > + goto err_mem;
> > +
> > + hwmon->class_device = hwmon_device_register(&pdev->dev);
> > + if (IS_ERR(hwmon->class_device)) {
> > + ret = PTR_ERR(hwmon->class_device);
> > + goto err_sysfs;
> > + }
> > +
> > + return 0;
> > +
> > +err_sysfs:
> > + sysfs_remove_group(&pdev->dev.kobj, &da9052_attr_group);
> > +err_mem:
>
> I think you should do a kfree(hwmon) here.
>

Not needed because devm_kzalloc() is used above.

> > + return ret;
> > +}
> > +
> > +static int __devexit da9052_hwmon_remove(struct platform_device *pdev)
> > +{
> > + struct da9052_hwmon *hwmon = platform_get_drvdata(pdev);
> > +
> > + hwmon_device_unregister(hwmon->class_device);
> > + sysfs_remove_group(&pdev->dev.kobj, &da9052_attr_group);
>
> Kfree(hwmon);
>
Same here.

Guenter




\
 
 \ /
  Last update: 2012-03-02 17:55    [W:0.094 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site