From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751396AbdEATWK (ORCPT ); Mon, 1 May 2017 15:22:10 -0400 Received: from mail-yw0-f181.google.com ([209.85.161.181]:32835 "EHLO mail-yw0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbdEATWF (ORCPT ); Mon, 1 May 2017 15:22:05 -0400 Date: Mon, 1 May 2017 15:22:02 -0400 From: Tejun Heo To: =?iso-8859-1?Q?Andr=E9?= Przywara Cc: Adam Borowski , Icenowy Zheng , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" Subject: Re: sun50i-a64-pinctrl WARN_ON drivers/base/dd.c:349 Message-ID: <20170501192202.GE8921@htj.duckdns.org> References: <20170316010615.GA23552@kroah.com> <20170317140812.GB5078@htj.duckdns.org> <785901489760914@web50g.yandex.ru> <20170317144422.GD5078@htj.duckdns.org> <3cf02066-ca0e-05f4-6a3d-ebc6d5373caf@arm.com> <20170418072505.GE3899@wtj.duckdns.org> <3fda46eb-7fcc-4c27-98b6-7d822cce1405@arm.com> <20170428220314.GI22354@htj.duckdns.org> <20170429212857.tvdsxi4tlft3mdpj@angband.pl> <043dc68f-aaec-48e8-4a92-e57d60a8ed08@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <043dc68f-aaec-48e8-4a92-e57d60a8ed08@arm.com> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sun, Apr 30, 2017 at 12:34:40AM +0100, André Przywara wrote: > >> If this is a valid use case, we can change devm to repeat till empty > >> but it's a weird thing to do to allocate from a release function. > >> > >> So, something like this. Only compile tested. > > I was wondering if using devm_*alloc in a _release_ function is valid at > all, given that it is called as part of the DEFER clean-up routine. > Looking at pinmux_generic_free_functions() it looks like we could > replace it with a (non-devm_) kmalloc version and it would still work > (given we add a kfree at the end). > Either that or we bail out early if pctldev->num_functions is zero. I was just throwing the idea but the more I think about it, the less sense it makes to me. So, I really think this should be fixed by dropping dev_kzalloc() call from the release function. It makes no sense. Thanks. -- tejun