Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp982436imu; Wed, 28 Nov 2018 02:45:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/VkyXpw0N/4qp5guBRFVLEH7eUdW+ezKINk4aF9qAWMunjjqTba9K+uU416hA5YRL0r4a0z X-Received: by 2002:a63:604f:: with SMTP id u76mr29786331pgb.401.1543401947487; Wed, 28 Nov 2018 02:45:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401947; cv=none; d=google.com; s=arc-20160816; b=zh6h8vUBHoSBymo2eXGwZgs45QY67E/4iDQ0m0bKUSVKMwEMMXFc+/zDSzK9q9n6CX YORxCYv1DMtHAR5svrGVNcOMHROg91FR2MJycmsBVBnFST+CwZsUNlS0UCezA47KAV95 qmn45Rarr4S1PcYgyhQKTXz/qRR8XL18LlMVhEwYmA7WVJTidWD4BKvIocAss1XlEYWd +1qtaaTnomZw9vEff0AUV1tAsHPgaWVRZ+f2W4Kk996GPp9olUG5KYCi9OgeCCkxchu9 pEk0+OyvDynjzCp69+OrazOtPSurPm/DjAI+8C9i/lbALBjcyJ/XvNn24AHy/o7MuRdY LZhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=nQcRmylpmtYcsk3IPazbHvjuvlV02bxwablBzHPxUl37iyqM6PMqUsVhn2rhg6200U uI39OR8DEz5J/wny1Mgmzda/HEERIBacn8XfOsvMS04jyS2PEjfCc1sT9b40f+RaiLUi JR+iZQo7QBRmN5w2TReqonxR3FdySPR49av0JHX+H8RUvhw5hFpDvUvf+Awy36XDLAzC gk6iC7fSIPHX3cRwQEzc0b1+xFje3x1Xs9Iv1laGrJZEK1WYduDUomlYG+QqfdzBwmox q8EaJXaijnoMJJRtQ1p7tDeYb/CmD0OZgQy0xEQY474oR2N7fqKRtSvoEMC7zJS8ZiH+ Pcyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nz0VKdjC; 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 j1si6898164plk.342.2018.11.28.02.45.32; Wed, 28 Nov 2018 02:45:47 -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=Nz0VKdjC; 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 S1728178AbeK1VpT (ORCPT + 99 others); Wed, 28 Nov 2018 16:45:19 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34897 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1VpT (ORCPT ); Wed, 28 Nov 2018 16:45:19 -0500 Received: by mail-lj1-f193.google.com with SMTP id x85-v6so22982008ljb.2 for ; Wed, 28 Nov 2018 02:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=Nz0VKdjCMqLGPbYKRJYOxaVnpQh1k58x0DVVOkjpY1BI3lwBX4HROZeN1QPA8vhlwp Xjg2dlpHd+vr6o2tPZT4t1T9ZjTOcMsmCdDC+dmQX/6YjAMaAqmlYtFYfvfBRtNo3bdZ D7pR+uGNDF41vynPtMgm0C+Z3M58qyv7tSPQU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=jhg1CJj/XtFu9RKpjhAjkUZFS7Nb1uHqu/NeP8hW7X7aJRFBdPzFNBEBjUg8NVMR48 aDdzm7NHA8v3+ECuTmR4jRDVU5kqfvl7p0KbK38OPFn8I7ArT7E1kyCLkdTI5tqjRFpO GIn9zYDWZVLb1Tzr/Myw0KKQYgiGaXp8FtjutT1eQ1DjZWwI7R2utfLYpXXnzDSmW7W9 lkfACSHL56it/xd4kEnfm9TixYM7P7aeGyycBdVb0D2qhWQbmUyhBPISQ6Kgjeeh64J1 dleXLdb1m7S8d2lDr4lsW+feOpmPQQfuiQXbSz+kZP671uCkT9WbSM0aF94dYBiA6rJx /TeA== X-Gm-Message-State: AA+aEWYIfMFD86aIRgW1xHqDzSzYFPGM3qoyOXCewdvIlJghV+khJLui 2jq/ihAMQDFbDqZruQqfvEeqYnzKi4IDmA== X-Received: by 2002:a2e:5054:: with SMTP id v20-v6mr22072216ljd.45.1543401844472; Wed, 28 Nov 2018 02:44:04 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c20sm1095101lfj.67.2018.11.28.02.44.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:03 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 04/10] regulator: max8952: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:44 +0100 Message-Id: <20181128104350.31902-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128104350.31902-1-linus.walleij@linaro.org> References: <20181128104350.31902-1-linus.walleij@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the gpiod_get() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. Fixes: d7a261c2d1f2 ("regulator: max8952: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/max8952.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 6c39fff73b8a..baa8b771a6e4 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c @@ -231,9 +231,9 @@ static int max8952_pmic_probe(struct i2c_client *client, else gflags = GPIOD_OUT_LOW; gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - gpiod = devm_gpiod_get_optional(&client->dev, - "max8952,en", - gflags); + gpiod = gpiod_get_optional(&client->dev, + "max8952,en", + gflags); if (IS_ERR(gpiod)) return PTR_ERR(gpiod); if (gpiod) @@ -241,6 +241,8 @@ static int max8952_pmic_probe(struct i2c_client *client, rdev = devm_regulator_register(&client->dev, ®ulator, &config); if (IS_ERR(rdev)) { + if (gpiod) + gpiod_put(gpiod); ret = PTR_ERR(rdev); dev_err(&client->dev, "regulator init failed (%d)\n", ret); return ret; -- 2.19.1