public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Q: pinctrl: freeing out the allocated map in tegra_pinctrl_dt_node_to_map
@ 2012-08-10  5:35 devendra.aaru
  2012-08-10 15:17 ` Stephen Warren
  0 siblings, 1 reply; 2+ messages in thread
From: devendra.aaru @ 2012-08-10  5:35 UTC (permalink / raw)
  To: linux-kernel

On Fri, Aug 10, 2012 at 11:02 AM, devendra.aaru <devendra.aaru@gmail.com> wrote:
> Hi,
>
> In function tegra_pinctrl_dt_node_to_map the num_maps the num_maps
> counter must be incremented for each child node?
>
>
> Actually we are doing free until num_maps if tegra_pinctrl_dt_subnode_to_map,
>
> not only that if num_maps == 0, we wont free up the maps, and also i
> think the for_each_of_node checks whether we have a next child node,
> so its safe to do num_maps++ as it wont get incremented endlessly,
>
> Please correct me if i am wrong.
>
> Thanks,
>
>
> diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
> index ae52e4e..33ae918 100644
> --- a/drivers/pinctrl/pinctrl-tegra.c
> +++ b/drivers/pinctrl/pinctrl-tegra.c
> @@ -303,6 +303,7 @@ int tegra_pinctrl_dt_node_to_map(struct
> pinctrl_dev *pctldev,
>         *num_maps = 0;
>
>         for_each_child_of_node(np_config, np) {
> +               num_maps++;
>                 ret = tegra_pinctrl_dt_subnode_to_map(pctldev->dev, np, map,
>                                                       &reserved_maps, num_maps);
>                 if (ret < 0) {


Sorry all, I forgot to add the subject line.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Q: pinctrl: freeing out the allocated map in tegra_pinctrl_dt_node_to_map
  2012-08-10  5:35 Q: pinctrl: freeing out the allocated map in tegra_pinctrl_dt_node_to_map devendra.aaru
@ 2012-08-10 15:17 ` Stephen Warren
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Warren @ 2012-08-10 15:17 UTC (permalink / raw)
  To: devendra.aaru; +Cc: linux-kernel, Linus Walleij

On 08/09/2012 11:35 PM, devendra.aaru wrote:
> On Fri, Aug 10, 2012 at 11:02 AM, devendra.aaru <devendra.aaru@gmail.com> wrote:
>> Hi,
>>
>> In function tegra_pinctrl_dt_node_to_map the num_maps the num_maps
>> counter must be incremented for each child node?

This I commented on below.

>> Actually we are doing free until num_maps if tegra_pinctrl_dt_subnode_to_map,
>>
>> not only that if num_maps == 0, we wont free up the maps, and also i
>> think the for_each_of_node checks whether we have a next child node,
>> so its safe to do num_maps++ as it wont get incremented endlessly,
>>
>> Please correct me if i am wrong.

I don't quite understand this part, sorry.

>> Thanks,

>> @@ -303,6 +303,7 @@ int tegra_pinctrl_dt_node_to_map(struct
>> pinctrl_dev *pctldev,
>>         *num_maps = 0;
>>
>>         for_each_child_of_node(np_config, np) {
>> +               num_maps++;
>>                 ret = tegra_pinctrl_dt_subnode_to_map(pctldev->dev, np, map,
>>                                                       &reserved_maps, num_maps);

That's wrong; tegra_pinctrl_dt_subnode_to_map() calls add_map_mux()
and/or add_map_configs() which increments *num_maps.

Besides, num_maps is a pointer to an integer, so if this was right, it
should be (*num_maps)++.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-10 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-10  5:35 Q: pinctrl: freeing out the allocated map in tegra_pinctrl_dt_node_to_map devendra.aaru
2012-08-10 15:17 ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox