Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754120AbcDKLPX (ORCPT ); Mon, 11 Apr 2016 07:15:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:29707 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753561AbcDKLPU (ORCPT ); Mon, 11 Apr 2016 07:15:20 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,462,1455004800"; d="asc'?scan'208";a="942647229" From: Felipe Balbi To: "Du\, Changbin" 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 In-Reply-To: <0C18FE92A7765D4EB9EE5D38D86A563A05CFE203@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> User-Agent: Notmuch/0.21+96~g9bbc54b (http://notmuchmail.org) Emacs/25.0.90.3 (x86_64-pc-linux-gnu) Date: Mon, 11 Apr 2016 14:13:22 +0300 Message-ID: <87shyso0tp.fsf@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2149 Lines: 63 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable "Du, Changbin" writes: >> > 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 =3D NULL; >> > + >> > + kfree(dwc->regset); >>=20 >> we also need a kfree() on dwc3_debugfs_init(). > This patch is based on the patch set=20 > [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void>=20 > So, they do has dependency. :) I _did_ mention on previous set that fixes and new-features shouldn't have dependencies between them. That was the whole point of splitting the series in two. >> > + dwc->regset =3D NULL; >>=20 >> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() >> when removing the driver. >>=20 >> -- >> Balbi > I'd like keep this line even it is unnecessary, because It is a good habi= t to > Avoid wild pointers. Just like the dwc->root =3D NULL. there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXC4bTAAoJEIaOsuA1yqREmagQAKkhTZuIYb08x8PgboztjItP p5w9G6aBfV4vehQZYIIDNnglyRR0EPbs8KxjMVjcic0BthATbyfBVtk69nhgT0Nx ciJD8e6cqT299n9nQdk2zdSjYbDvMMF8uR2+/mlc/YBBYFFiaFYxLOYAIK6uuJyA l4mwf5dyJx90QtFcfVeMa8x8ueq+LYF4Z9zMtEpur1iVNXm9Y7n4o6JfoouKXRLa UMQJ35PbYxIdG7S0RqjHCcJJp2SqsWucMobuhBS++VAJZSNmgHhyExahViPewY8h 7UqzVBy8sOtxkwIgaBzGKktk7GD3pOaMvPh7pFZvC5/09Q8bSUk6hnTJ8KRd0qIa keSW+B0fW9wohDrKTNrJKmcFHJOgZDvJr/+5o8U7zN6SmUx//mIrmUlnHPQmao2a sb1JSbZ8FjnPNRw/O87c4+IsP9WhLMA95ZF6P5F9yU2T62+Ab42L6+6X7xzzRvZZ RwY6Lke0m7tEcXjxfWSVpiHnNJofFoMeL3rB+hNtYN4KelMb2uYHEHOGPhxXkyym hHn3Vnz4RS7JSeG1YfacQrHxj+g6v6W3LXSqbxkutLGV0FF5XJVM9MRo1PM/PbEY T9jbBZ+EslkJXkkDhxhymAUWqkFeOLko7jURnD1JvPKtrvWQr2OGFe/QT5aVd5i0 +xmA9p2CsV35YhRnloJZ =Ya6s -----END PGP SIGNATURE----- --=-=-=--