Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2629053imu; Thu, 29 Nov 2018 07:53:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/W5khxOc2nlzoPNcLuB2d8OFINZaWRtf3JFowz4CmNC4a52xL4OxwWArDfQMkWTcAXCm224 X-Received: by 2002:a17:902:5a0b:: with SMTP id q11mr2011338pli.186.1543506833268; Thu, 29 Nov 2018 07:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543506833; cv=none; d=google.com; s=arc-20160816; b=OsG+iOFPTEavjL6FefDTQY7s/V8hxlXBtHCwdY+Hnr8b1DW+jbVfcjRGpZhLe+AUQU q3UQus0LiOEHXwHjDHbttaVGOBSXJnpZz43/jWsIKhHqmVz0swKg5IDBbydEmLVeOWt5 +QobqNzYBZU0w3YTEBJd6mICh003rBssuRBoTxcNVExlIpZx+rNHtNxxDY7G90paPLsV gWL0e5f+bmFf5HPF9c1wplPPeo1Bbfv0jmeinRJjwiuW8IsLv5aHGG66E5MbHvVaroie yr3ByVYpgFdwzy3i+lZ1/ioV8q8CbEXgR/nJBcmABgPVc6B1vTvITjPZFbkoMye2aLkA pkLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=da3AppwzXGPvOD3ftUCJ9KY8Z3DJWPfM0kVqOzkBmmk=; b=ap9dhDP4oXb0wDU0aAhZ6F324zzFVm8oZGzPf9iHHG4VRGKZSAp5OcJg4E8rKrpSgT XLWtzK/g+zYeD6dMngklsBz0ydCxeUj3P8qL8daS6MvV79wHcMkmJ3cN1cX2OL5tejBy a0tGEZ3UB+y9KsKsdsvX4GRk3QEwHnA0kpQ67La7qKsEbqmaEH/LJGxU9bxLl/qUnIQv cmoMSK2fRmzo5rMY/tUh7hBmr2OVi4cogwbtLfqn//uoF70Hme0ryYJhEGHngEgdY0dL 1Q+P1/UZlft9w50oLz0x9X9Xlv8gr9EUn0FCyMY6R8QwWWJylPkhoV9jPUrJ2boclVP+ A3AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKiVHeuZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20si2341388pgg.271.2018.11.29.07.53.33; Thu, 29 Nov 2018 07:53:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKiVHeuZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729306AbeK3C6H (ORCPT + 99 others); Thu, 29 Nov 2018 21:58:07 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39404 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729152AbeK3C6G (ORCPT ); Thu, 29 Nov 2018 21:58:06 -0500 Received: by mail-lj1-f194.google.com with SMTP id t9-v6so2177383ljh.6 for ; Thu, 29 Nov 2018 07:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=da3AppwzXGPvOD3ftUCJ9KY8Z3DJWPfM0kVqOzkBmmk=; b=CKiVHeuZii+/DHBhJ7fahs/4hx8T+rhECFvCHTGGzzgqBVN/CLajirpLra6kdwxNG2 M41BeDci91V2zADwPzcBGCxIofw9UKp9KaARUpyY7KrCWi7wCl9rS+fqCaaIkBl7VhcW LnJ3va3jbWFj0iGPN/16lK+wEJSNOFXJmmCGM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=da3AppwzXGPvOD3ftUCJ9KY8Z3DJWPfM0kVqOzkBmmk=; b=UuQjYCRMR8Ai1+dYTmTJeJUcSGRUnPs0WAtsFdb8hIODJnnFsU3uf0LSI0kZ5B+tni ho4nl9wQkgETc0B1SBHUXgcFkcn9ioDv6i7gMr0lJBzOGfMTpq6MgB1C+tSuAVI9MNhA cBOBAXGiRULI0gERrgInR0aJMY2MdS8HMIyOVvhkGrLkPyyXuDwg6RJcZrp1Bs4ZsCaS HSw57wIWSSRoKlWhrI60cm5lfKkAOhbOGDPrZH/FNHTBoU1jBUrtRcsxmT4zU1zoeMde YzC35n2X5bnyHPEWrgiBIh776re0vjGKGPsXwSTvXJaRG9dkSxr4B9pds5byTnFWykZm /iYA== X-Gm-Message-State: AA+aEWZB1GHLtDYHb6bEQj1mzPlZHlie+g6YEaISg8n6rJG9jlk7UBE2 8M68/94MA2Ok6tm2rSJ1ZU4087jG3GydAJFveuybyQ== X-Received: by 2002:a2e:29d7:: with SMTP id p84-v6mr1478583ljp.12.1543506736812; Thu, 29 Nov 2018 07:52:16 -0800 (PST) MIME-Version: 1.0 References: <20181128104350.31902-1-linus.walleij@linaro.org> <20181128152238.GV16508@imbe.wolfsonmicro.main> In-Reply-To: <20181128152238.GV16508@imbe.wolfsonmicro.main> From: Linus Walleij Date: Thu, 29 Nov 2018 16:52:04 +0100 Message-ID: Subject: Re: [PATCH 00/10] Regulator ena_gpiod fixups To: Charles Keepax Cc: Liam Girdwood , Mark Brown , "linux-kernel@vger.kernel.org" , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 4:22 PM Charles Keepax wrote: > It looks like the patches are assuming the regulator core, > doesn't free the GPIO on an error, however that is not true in > all cases. If only a single regulator has requested the GPIO then > all the error paths after the call to regulator_ena_gpio_request > in regulator_register will free the GPIO. I guess part of it is that I should make sure not to gpiod_put() if the [devm_]regulator_register() fails, I will go over the series with that in mind! Essentially the semantic is that the [devm_]regulator_register() call will immediately take ownership of the descriptor and place it in the regulator core. I'll check! > Although this is not the > case if more than one regulator has requested the GPIO. This should be fine since the regulator core refcounts it, when all the other regulators drops it, gpiod_put() will be called as the refcount goes down to 0. Yours, Linus Walleij