Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1375737

RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit

From "Du, Changbin" <changbin.du@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Date 2016-04-11 13:40 +0200
Message-ID <rmImf-57L-33@gated-at.bofh.it> (permalink)
References <rlBmO-1PG-9@gated-at.bofh.it> <rmF50-2CR-7@gated-at.bofh.it> <rmHTc-4Qu-27@gated-at.bofh.it> <rmI2S-4Vk-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> 
> >> > +	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
I agree the dwc will be freed in current code. But the 'free' logical is out
of the debugfs code. They should be treat as some logical independent. Per
this point, I still think set pointer to null is not bad. For example, if dwc3 core
code invoke dwc3_debugfs_exit twice by mistake(just an example case, not
really), then no crash/impact for the second call.

Thanks,
Du, Changbin

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit changbin.du@intel.com - 2016-04-08 12:00 +0200
  Re: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit Felipe Balbi <balbi@kernel.org> - 2016-04-11 10:10 +0200
    RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit "Du, Changbin" <changbin.du@intel.com> - 2016-04-11 13:10 +0200
      RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit Felipe Balbi <balbi@kernel.org> - 2016-04-11 13:20 +0200
        RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit "Du, Changbin" <changbin.du@intel.com> - 2016-04-11 13:40 +0200
          RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit Felipe Balbi <balbi@kernel.org> - 2016-04-11 14:20 +0200
            RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit "Du, Changbin" <changbin.du@intel.com> - 2016-04-12 04:20 +0200
              RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit Felipe Balbi <balbi@kernel.org> - 2016-04-12 08:30 +0200
                RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit "Du, Changbin" <changbin.du@intel.com> - 2016-04-12 09:00 +0200
                RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit Felipe Balbi <balbi@kernel.org> - 2016-04-12 10:10 +0200
                Re: [PATCH v2] usb: dwc3: fix memory leak of dwc->regset Felipe Balbi <balbi@kernel.org> - 2016-04-12 10:30 +0200
                [PATCH v3] usb: dwc3: fix memory leak of dwc->regset changbin.du@intel.com - 2016-04-12 10:40 +0200
                Re: [PATCH v3] usb: dwc3: fix memory leak of dwc->regset Felipe Balbi <balbi@kernel.org> - 2016-04-12 12:20 +0200
                [PATCH v2] usb: dwc3: fix memory leak of dwc->regset changbin.du@intel.com - 2016-04-12 10:30 +0200

csiph-web