Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8031531imu; Tue, 4 Dec 2018 01:34:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/W1j6bDroOZQQtjNuQkOPesSaw9OFSNYU7P2Kw+dfZafsUobGubBim+fGJyHyeCvCQnER+2 X-Received: by 2002:a63:1d1d:: with SMTP id d29mr16332683pgd.49.1543916060878; Tue, 04 Dec 2018 01:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543916060; cv=none; d=google.com; s=arc-20160816; b=C16dU+D4y3AxH/6qoZxIU8FFFOeodKoDJs0ibnwiqgImxzNTB7BgWeKGeK8cNgV3NH ZCRpR78TOcs7vtAU6ZAluFlhhBSEOF9QzPRIjSmdGo1o5m072Z/SzHotibnM/SvdrWQp 8H1bgQtdlBG/9CsTKIxTBMeFuA2YG9Jmb2RR6mzYJrFNhv2KF7GkV8XlP+lmXtJAtbXQ kWqcwv50tUZuyXvTp6QmBaan/xvlQ1sCPISxyYnct5TXYlb3tUPqdyd6IqJExgQRHW6S DN/OAQNmGeGYBMgWi78Ct5NvtgDaioPBFa6BzZpE4VPEZxXXXbiI+rQBod+24S6RNiQy hFEg== 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=X/+uP3K8EqS6DjUlKc3PTvxgefYHP/AxCgxfi+++j3c=; b=qJHTU//xw8uu1zQ6YQcioG6C4eqAnQBvUt401xqXA7qsw0jCcaKDzHIsKGqQMJMvhB VOWjhrCRl6EmPunmET7bJJuaDUTIXNSRv6XYjj1tafdCV4Y1GJXUeb/4y9BAk+uqCRfq 5sMm8Oei9tdUigv+T2IPih7UbkUufs06eib1ubwN2e2AAUdlm8VeZfKUXDygiy/BNaoK DVqnrWg+bndejtMbFg7DZPSrhWAbuFwuls9ETNaf24o2S0gb8vCBTfDtOiqzmKIuT3Iw 1Vjbw80wLYtBIxgH7afb6R0KMCO+yQUkL4N2/DYusL323CUjBGQ2pzjpWv5SDBHeZd0o k1Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ARiKUZqQ; 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 a11si19687622pln.78.2018.12.04.01.33.51; Tue, 04 Dec 2018 01:34:20 -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=ARiKUZqQ; 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 S1725955AbeLDJbf (ORCPT + 99 others); Tue, 4 Dec 2018 04:31:35 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44518 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725613AbeLDJbf (ORCPT ); Tue, 4 Dec 2018 04:31:35 -0500 Received: by mail-lf1-f68.google.com with SMTP id z13so11385457lfe.11 for ; Tue, 04 Dec 2018 01:31:32 -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=X/+uP3K8EqS6DjUlKc3PTvxgefYHP/AxCgxfi+++j3c=; b=ARiKUZqQdKQ/cwek5oMlZZ2VJxpmPViqJkYf6xwyZsAOB61JCPd+jmkAugBGp692RD QhdMsLYJx099VKQAi8B8QXNQJUfxV36MjNuYsig7krJL8ishUsMOCdQs1+3ObrMM9oYp IHUi3SwGqLE5ufXg9lEeT9GQsXwJpNP9FKpUs= 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=X/+uP3K8EqS6DjUlKc3PTvxgefYHP/AxCgxfi+++j3c=; b=AHwBYckwtx9gKKyXy4eKgRbUtyf3aL6UtV6PXynureAE2U84Q4KDIQjKdQBpyXsczi tyHOoowptnAur8Y2XD+cJtU3YHvbVl80OrCBIOhWF2Np2nkKRI5Zj0X9eoSxQHUmHAuC 8FE/iegAhGjL5GbeiV9URzIswP2CIYEs+8hAm7v1eVOtkt/ManukSbCXI2SPr7T3wzaa X+QFAW8nyg14fI2jKVNDZ/i29aw/ZppERnqEekitlFIfmVvh3SExhKiFPBosoIiDfGiL cdvt8tVD4WZoIkSDsNTTixeHK7PNntLqYMfv8oXrD8KeDfAO8zksrhYwGZGxrh1cMxpM KpYg== X-Gm-Message-State: AA+aEWaNGOQHlyNNDcxmPqR4Q5FWHeST8RbdOG8E8hvefHekUX75adN7 8aq0Bv7nagF7n8IKCmv4Ataf7UbuyXHUWRmMks8pLA== X-Received: by 2002:a19:5154:: with SMTP id f81mr11880370lfb.96.1543915891274; Tue, 04 Dec 2018 01:31:31 -0800 (PST) MIME-Version: 1.0 References: <20181201154151.14890-1-linus.walleij@linaro.org> In-Reply-To: From: Linus Walleij Date: Tue, 4 Dec 2018 10:31:19 +0100 Message-ID: Subject: Re: [PATCH 00/13 v2] Regulator ena_gpiod fixups To: Marek Szyprowski Cc: Liam Girdwood , Mark Brown , "linux-kernel@vger.kernel.org" , Charles Keepax , 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 Hi Marek, first, thanks a *lot* for testing this, it is is much, much appreciated! On Mon, Dec 3, 2018 at 3:35 PM Marek Szyprowski wrote: > The idea is good imho, but it looks that there are some missing cases in > the code. Here are some logs from the boards I have access to: OK let's fix this! > Artik5 evaluation board (arch/arm/boot/dts/exynos3250-artik5-eval.dtb): > s2mps11-pmic s2mps14-regulator: Failed to get control GPIO for 11/LDO12 Question: this is supposed to fail, right? It is something like a probe deferral or nonexisting GPIO controller? I look in the upstream tree: arch/arm/boot/dts/exynos3250-artik5.dtsi where s2mps14 is defined: ldo12_reg: LDO12 { /* VDD72 ~ VDD73 */ regulator-name = "VLDO12_2.8V"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>; samsung,ext-control-gpios = <&gpk0 2 GPIO_ACTIVE_HIGH>; }; I didn't really change anything about this, so this missing GPIO descriptor looks worrysome. Anyways what happens is this: gpio[reg] = devm_gpiod_get_from_of_node(...) if (IS_ERR(gpio[reg])) (...) continue; So this IS_ERR descriptor is left around. So we should probably handle erronoeus or NULL descriptors in gpiod_unhinge(). If you add this on top, does it start working? diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c index 5864e758d7f2..e35751bf0ea8 100644 --- a/drivers/gpio/gpiolib-devres.c +++ b/drivers/gpio/gpiolib-devres.c @@ -332,6 +332,8 @@ EXPORT_SYMBOL(devm_gpiod_put); void devm_gpiod_unhinge(struct device *dev, struct gpio_desc *desc) { + if (IS_ERR_OR_NULL(desc)) + return; WARN_ON(devres_destroy(dev, devm_gpiod_release, devm_gpiod_match, desc)); } Yours, Linus Walleij