lkml.org 
[lkml]   [2016]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Date
"Du, Changbin" <changbin.du@intel.com> writes:

>> > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
>> > index 9ac37fe..9eeb444 100644
>> > --- a/drivers/usb/dwc3/debugfs.c
>> > +++ b/drivers/usb/dwc3/debugfs.c
>> > @@ -687,4 +687,7 @@ void dwc3_debugfs_exit(struct dwc3 *dwc)
>> > {
>> > debugfs_remove_recursive(dwc->root);
>> > dwc->root = NULL;
>> > +
>> > + kfree(dwc->regset);
>>
>> we also need a kfree() on dwc3_debugfs_init().
> This patch is based on the patch set
> [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void>
> So, they do has dependency. :)

I _did_ mention on previous set that fixes and new-features shouldn't
have dependencies between them. That was the whole point of splitting
the series in two.

>> > + dwc->regset = NULL;
>>
>> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit()
>> when removing the driver.
>>
>> --
>> Balbi
> I'd like keep this line even it is unnecessary, because It is a good habit to
> Avoid wild pointers. Just like the dwc->root = NULL.

there won't be any wild pointers here, we'll free struct dwc3 *dwc itself.

--
balbi
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-04-11 13:41    [W:0.114 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site