[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1330707053.23014.279.camel@groeck-laptop>
Date: Fri, 2 Mar 2012 08:50:53 -0800
From: Guenter Roeck <guenter.roeck@...csson.com>
To: "R, Durgadoss" <durgadoss.r@...el.com>
CC: Ashish Jangam <ashish.jangam@...tcummins.com>,
"randy.dunlap@...cle.com" <randy.dunlap@...cle.com>,
"linaro-dev@...ts.linaro.org" <linaro-dev@...ts.linaro.org>,
"sameo@...ux.intel.com" <sameo@...ux.intel.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lm-sensors@...sensors.org" <lm-sensors@...sensors.org>,
"dchen@...semi.com" <dchen@...semi.com>
Subject: RE: [lm-sensors] [PATCH 02/03] HWMON: HWMON driver for DA9052/53
PMIC v3
Hi Durga,
On Fri, 2012-03-02 at 11:44 -0500, R, Durgadoss wrote:
> Hi,
>
> > -----Original Message-----
> > From: lm-sensors-bounces@...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@...cle.com; linaro-dev@...ts.linaro.org;
> > sameo@...ux.intel.com; linux-kernel@...r.kernel.org; lm-sensors@...sensors.org;
> > dchen@...semi.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@...semi.com>
> > Signed-off-by: Ashish Jangam <ashish.jangam@...tcummins.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists