Hi, On 10/23/2012 11:20 AM, Rajanikanth HV wrote: >>> diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c >>> index bf02225..ff64dd4 100644 >>> --- a/drivers/power/ab8500_fg.c >>> +++ b/drivers/power/ab8500_fg.c >>> @@ -22,15 +22,16 @@ > [...] >>> >>> #define MILLI_TO_MICRO 1000 >>> #define FG_LSB_IN_MA 1627 >>> @@ -212,7 +213,6 @@ struct ab8500_fg { >>> struct ab8500_fg_avg_cap avg_cap; >>> struct ab8500 *parent; >>> struct ab8500_gpadc *gpadc; >>> - struct abx500_fg_platform_data *pdata; >>> struct abx500_bm_data *bat; >>> struct power_supply fg_psy; >>> struct workqueue_struct *fg_wq; >>> @@ -2416,6 +2416,8 @@ static int __devexit ab8500_fg_remove(struct >>> platform_device *pdev) >>> int ret = 0; >>> struct ab8500_fg *di = platform_get_drvdata(pdev); >>> >>> + of_node_put(pdev->dev.of_node); >> >> This is wrong, the probe function doesn't increment the refcount of this >> node, so you don't have to decrement it here. > you hinted in one of your earlier comments as: > " > Also, if I'm not mistaken we have a leak here, because the refcount of > these nodes is never decremented, not even in the driver remove routine. > " while referring bmdevs_of_probe(..), nodes being referred, > np and np_bat_supply
Whenever you call of_find_node_*(), or of_parse_phandle(), the returned node has its refcount incremented, so of_node_put() should be called after you are done with the node. In your previous patch, you called of_find_node_by_phandle() multiple times, without calling of_node_put() on the corresponding nodes. In your last patch, you call of_parse_phandle() once, and then call of_node_put() on the returned node: that's all you have to do. You don't have to call of_node_put() on pdev->dev.of_node, because you never incremented the refcount of that node. -- Francesco _______________________________________________ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev