Hi Durga, On Fri, 2012-03-02 at 11:44 -0500, R, Durgadoss wrote: > Hi, > > > -----Original Message----- > > From: lm-sensors-boun...@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.dun...@oracle.com; linaro-dev@lists.linaro.org; > > sa...@linux.intel.com; linux-ker...@vger.kernel.org; > > lm-sens...@lm-sensors.org; > > dc...@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 <dc...@diasemi.com> > > Signed-off-by: Ashish Jangam <ashish.jan...@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 _______________________________________________ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev