Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943059AbcJ0Ol3 (ORCPT ); Thu, 27 Oct 2016 10:41:29 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:35461 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S942196AbcJ0Okc (ORCPT ); Thu, 27 Oct 2016 10:40:32 -0400 Date: Thu, 27 Oct 2016 15:51:02 +0530 From: Viresh Kumar To: Charles Keepax Cc: Lee Jones , linaro-kernel@lists.linaro.org, broonie@kernel.org, patches@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3] mfd: wm8994-core: Don't use managed regulator bulk get API Message-ID: <20161027102102.GE10423@vireshk-i7> References: <20161027091413.GI28180@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161027091413.GI28180@localhost.localdomain> 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 Content-Length: 1156 Lines: 31 On 27-10-16, 10:14, Charles Keepax wrote: > On Thu, Oct 27, 2016 at 09:09:30AM +0530, 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 resources are freed isn't correct. > > > > The regulators are added as children of wm8994->dev. > > 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(). > > > > --------x------------------x---------------- > > The back track seems to have got really really long again. Not just that, even the code moved a version back. Sorry for the noise, the right version is sent now :( -- viresh