Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754625AbcDKLjC (ORCPT ); Mon, 11 Apr 2016 07:39:02 -0400 Received: from mga11.intel.com ([192.55.52.93]:34862 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754225AbcDKLjA convert rfc822-to-8bit (ORCPT ); Mon, 11 Apr 2016 07:39:00 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,462,1455004800"; d="scan'208";a="929888993" 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+D6PoAgACmx7D//417AIAAiixQ Date: Mon, 11 Apr 2016 11:38:53 +0000 Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A05CFE28D@shsmsx102.ccr.corp.intel.com> References: <1460108522-31664-1-git-send-email-changbin.du@intel.com> <87bn5gpo1v.fsf@intel.com> <0C18FE92A7765D4EB9EE5D38D86A563A05CFE203@shsmsx102.ccr.corp.intel.com> <87shyso0tp.fsf@intel.com> In-Reply-To: <87shyso0tp.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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWFjOTdkM2UtNjJmYi00MGVhLWI4N2MtYzRkYTgxMjQ5NTg0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlBYZnVoTUEwcVR1eFwvdk82QTBqSlY2Z1JVXC9YYmtnZkl5U01GXC9wUkZwRXc9In0= 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: 786 Lines: 23 > > >> > + 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