From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755718AbdEETzg (ORCPT ); Fri, 5 May 2017 15:55:36 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:37911 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751653AbdEETze (ORCPT ); Fri, 5 May 2017 15:55:34 -0400 Date: Fri, 5 May 2017 21:55:18 +0200 From: Maxime Ripard To: Tejun Heo Cc: Andre Przywara , Linus Walleij , Icenowy Zheng , Adam Borowski , Greg Kroah-Hartman , Chen-Yu Tsai , linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pinctrl: use non-devm kmalloc versions for free functions Message-ID: <20170505195518.xbn5n7uzo2xherah@lukather> References: <1493855857-4453-1-git-send-email-andre.przywara@arm.com> <20170504120314.lfmcv4cpsuz2igte@lukather> <20170504160032.GA5147@htj.duckdns.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6aydbuxqvnkurcoa" Content-Disposition: inline In-Reply-To: <20170504160032.GA5147@htj.duckdns.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --6aydbuxqvnkurcoa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 04, 2017 at 12:00:32PM -0400, Tejun Heo wrote: > Hello, >=20 > On Thu, May 04, 2017 at 02:03:14PM +0200, Maxime Ripard wrote: > > > @@ -704,6 +704,7 @@ static void pinctrl_generic_free_groups(struct pi= nctrl_dev *pctldev) > > > radix_tree_delete(&pctldev->pin_group_tree, indices[i]); > > > devm_kfree(pctldev->dev, group); > > > } > > > + kfree(indices); > >=20 > > We use devm_kfree for other allocations done here, maybe we can just > > have the same thing here? We would be consistant, and we would still > > keep the resource tracking. >=20 > It doesn't make any sense to use the managed functions from the > release functions and if you're always matching devm_kmalloc() with > devm_kfree(), the only thing it'd do is confusing its readers. I wouldn't say that being able to recover and free whatever memory leak we might have not making sense, but ok. That was one of the options, let's discard it. The other one is: refactor the rest of the allocations so that you don't have a mix of devm_kmalloc / devm_kfree and kmalloc / kfree for the same purpose in the same function. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --6aydbuxqvnkurcoa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAABCAAGBQJZDNiiAAoJEBx+YmzsjxAgAy4QAJlW+xDb5kWBxCO99xBjjKRR vr6D8J1/oHJE763dxi3sp1oZqYHC47JrA9VDFZMGH8PuGsfDMB+76IfHmHc0VPtU eJGlh3u40o1DTfy4lEaefUBINtIU3Rak+dsRH0Vw0izodzSr0FJOThhxG2NSOOpy n3NSu42hYOpoaMhXQtE0jBaUQ55bp4KLpL0znQNlxj8lRvJjNi9IjXsT4HkTIimZ +W2LwstLPb+MH/65iR7/kJhQp8TASq+vjJi+wRTuBHKU3hrfyKBFHI2P0ddwUru1 QWl0u5K+8VCFtp4f19bUPdyDcLGWpI1azo0n6yBKYZaJhjCg5qqUEDy0UHRiqz76 LYr9Ja5PVzzWw2UMj0jSh3nI3206IIY3ZQV/d1qpLF9IO9Akkk9X8wVFJcfA/HD4 2NKyuCx5hKUaPKDFN/1JxkWtKy43qlchHSdu+1NgPmw5c57usYyV1VqC5Ucx2KQ7 Z4mv0CndkkU7LrM9mqNH2hxlzpf39TuepxHBLhlSnMkSECdfmvO8KoLtjbXs+MRK b9a6htrc0Jc3XEQ+GwVspdzwoGTJss7uKo4UBfWsVOaFQWrGYoeMobcPDvodgfoB SS0ct+DvmRFwh+BhGZLDP4tfkDsLa00sLy06Mnr67ktzPxdP3Zeq9TjtHmUcQ8vk Kau8ayBSwv8b5UDjJnZX =u0zL -----END PGP SIGNATURE----- --6aydbuxqvnkurcoa--