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


Groups > linux.kernel > #1375564

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

From Felipe Balbi <balbi@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Date 2016-04-11 10:10 +0200
Message-ID <rmF50-2CR-7@gated-at.bofh.it> (permalink)
References <rlBmO-1PG-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

changbin.du@intel.com writes:
> From: "Du, Changbin" <changbin.du@intel.com>
>
> dwc->regset is allocated on dwc3_debugfs_init, and should
> be released on dwc3_debugfs_exit.
>
> Signed-off-by: Du, Changbin <changbin.du@intel.com>
> ---
> This patch is seperated from patch set:
>  [PATCH v2 0/3] Improvement, fix and new entry for dwc3 debugfs
> Because it is not related to other 2 patches.
>
> ---
>  drivers/usb/dwc3/debugfs.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> 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().

> +	dwc->regset = NULL;

setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit()
when removing the driver.

-- 
balbi

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