lkml.org 
[lkml]   [2023]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: RE: [PATCH v6 1/2] usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver
From
Le 01/11/2023 à 07:27, Stanley Chang[昌育德] a écrit :
> Hi CJ,
>
> I think these functions are not needed in remove function.
>
> In dwc3_rtk_probe_dwc3_core,
> I have used
> dwc3_node = of_get_compatible_child(node, "snps,dwc3");
> and
> dwc3_pdev = of_find_device_by_node(dwc3_node);
>
> So, I call these put functions.
> platform_device_put(dwc3_pdev);
> of_node_put(dwc3_node);

Yes, but you call it only in the error handling path of the function.

I wonder if they should also be called in the remove function in order
to decrement the ref-counted reference.


Same in __get_dwc3_maximum_speed(), the reference taken by:
dwc3_np = of_get_compatible_child(np, "snps,dwc3");
is never released.


See the comment at [1] to see what I mean.


[1]: https://elixir.bootlin.com/linux/v6.6/source/drivers/of/base.c#L681

CJ
>
> Thanks,
> Stanley
>
>> Hi,
>>
>> Is something like
>> platform_device_put(dwc3_pdev);
>> of_node_put(dwc3_node);
>> needed in the remove function?
>>
>> (as done in the error handling path of dwc3_rtk_probe_dwc3_core())
>>
>> Or should it be added at the end of dwc3_rtk_probe_dwc3_core() if the
>> reference are nor needed anymore when we leave the function?
>>
>> CJ
>>
>>> + of_platform_depopulate(rtk->dev); }
>>> +
>>
>> ...
>

\
 
 \ /
  Last update: 2023-11-01 08:50    [W:0.064 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site