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


Groups > linux.kernel > #1375696

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

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From "Du, Changbin" <changbin.du@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Date Mon, 11 Apr 2016 13:10:02 +0200
Message-ID <rmHTc-4Qu-27@gated-at.bofh.it> (permalink)
References <rlBmO-1PG-9@gated-at.bofh.it> <rmF50-2CR-7@gated-at.bofh.it>
X-Original-To Felipe Balbi <balbi@kernel.org>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.24,462,1455004800"; d="scan'208";a="929873312"
Thread-Topic [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Thread-Index AQHRkXxyY3OKy5PsYkGv+nYrf2hue5+D6PoAgACmx7A=
Accept-Language en-US
Content-Language en-US
X-Ctpclassification CTP_IC
X-Titus-Metadata-40 eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWVlNDVhY2UtYTIzZC00NmZhLWI0MGQtMjJkNDg1ODcyZGVlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InNGV3VnRHNwSVlqbTY3K1l0ZWxTaVg1bDJWeDNxYVRlc2ROeUMxZkVqT1k9In0=
X-Originating-IP [10.239.127.40]
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding 8BIT
MIME-Version 1.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 28
Organization linux.* mail to news gateway
X-Original-Cc "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>, "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Mon, 11 Apr 2016 11:09:39 +0000
X-Original-Message-ID <0C18FE92A7765D4EB9EE5D38D86A563A05CFE203@shsmsx102.ccr.corp.intel.com>
X-Original-References <1460108522-31664-1-git-send-email-changbin.du@intel.com> <87bn5gpo1v.fsf@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1375696

Show key headers only | View raw


> > 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. :)

> > +	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.

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