Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754033AbcDKLJp (ORCPT ); Mon, 11 Apr 2016 07:09:45 -0400 Received: from mga01.intel.com ([192.55.52.88]:39503 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753735AbcDKLJn convert rfc822-to-8bit (ORCPT ); Mon, 11 Apr 2016 07:09:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,462,1455004800"; d="scan'208";a="929873312" From: "Du, Changbin" To: Felipe Balbi CC: "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit Thread-Topic: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit Thread-Index: AQHRkXxyY3OKy5PsYkGv+nYrf2hue5+D6PoAgACmx7A= Date: Mon, 11 Apr 2016 11:09:39 +0000 Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A05CFE203@shsmsx102.ccr.corp.intel.com> References: <1460108522-31664-1-git-send-email-changbin.du@intel.com> <87bn5gpo1v.fsf@intel.com> In-Reply-To: <87bn5gpo1v.fsf@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 846 Lines: 28 > > 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