From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbcKYKZe (ORCPT ); Fri, 25 Nov 2016 05:25:34 -0500 Received: from mail-pg0-f49.google.com ([74.125.83.49]:33172 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751008AbcKYKZZ (ORCPT ); Fri, 25 Nov 2016 05:25:25 -0500 Date: Fri, 25 Nov 2016 15:46:21 +0530 From: Viresh Kumar To: Lee Jones 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: <20161125101621.GB12625@vireshk-i7> References: <0f6af89aa9093884d3668962ebc62383d8a209ec.1477563459.git.viresh.kumar@linaro.org> <20161125101407.GA10134@dell.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161125101407.GA10134@dell.home> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.. -- viresh