From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753096AbcKYKo4 (ORCPT ); Fri, 25 Nov 2016 05:44:56 -0500 Received: from mail-wj0-f174.google.com ([209.85.210.174]:35936 "EHLO mail-wj0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbcKYKop (ORCPT ); Fri, 25 Nov 2016 05:44:45 -0500 Date: Fri, 25 Nov 2016 10:41:11 +0000 From: Lee Jones To: Viresh Kumar Cc: linaro-kernel@lists.linaro.org, broonie@kernel.org, ckeepax@opensource.wolfsonmicro.com, patches@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4] mfd: wm8994-core: Don't use managed regulator bulk get API Message-ID: <20161125104111.GC10134@dell.home> References: <0f6af89aa9093884d3668962ebc62383d8a209ec.1477563459.git.viresh.kumar@linaro.org> <20161125101407.GA10134@dell.home> <20161125101621.GB12625@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161125101621.GB12625@vireshk-i7> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Nov 2016, Viresh Kumar wrote: > On 25-11-16, 10:14, Lee Jones wrote: > > On Thu, 27 Oct 2016, Viresh Kumar wrote: > > > > > The kernel WARNs and then crashes today if wm8994_device_init() fails > > > after calling devm_regulator_bulk_get(). > > > > > > That happens because there are multiple devices involved here and the > > > order in which managed resources are freed isn't correct. > > > > > > The regulators are added as children of wm8994->dev. Whereas, > > > devm_regulator_bulk_get() receives wm8994->dev as the device, though it > > > gets the same regulators which were added as children of wm8994->dev > > > earlier. > > > > > > During failures, the children are removed first and the core eventually > > > calls regulator_unregister() for them. As regulator_put() was never done > > > for them (opposite of devm_regulator_bulk_get()), the kernel WARNs at > > > > > > WARN_ON(rdev->open_count); > > > > > > And eventually it crashes from debugfs_remove_recursive(). > > > > Is ... > > > > mfd: wm8994-core: disable regulators before removing them > > > > ... required as well, or is that separate? > > It would be better if we get that too. Anyway, the $subject patch has a > dependency on it.. Which is ... ? -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog