Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp982348imu; Wed, 28 Nov 2018 02:45:42 -0800 (PST) X-Google-Smtp-Source: AJdET5fZvvgjZR3rjcFoKy7PZzfSo8dSNd0BJrUBflVTWY0MudO+Es/pgtk4ZcNhialFttq9fZ+D X-Received: by 2002:aa7:83c6:: with SMTP id j6mr36942598pfn.91.1543401942095; Wed, 28 Nov 2018 02:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401942; cv=none; d=google.com; s=arc-20160816; b=a+Rx7zpQK59meWFSAtcZV6tLpLs4kvDZ6EVQzZv4Fn/dOvuKE1gyDowPhWKzXQ0uMk IfysKuXs1HxwwkoCTC352I9jOtQ0ul7pkRE1QPsNJCPIfd7BFNAZY3U1PZkesBVQZsUw NISjBw6LXUwWc+9EbX6DWdHjdVYpRP2SnkBTXPJooVQDazXqVkDm9cY8u/9r8nzb23Jw EqSX1hbhaNExydykmrchQlj4O64Wb11X9Q2o/vSmvcFM9Epz1IRCDj3NVqZMXbxsiRfk w8S7KDhKLqlmmW3C5sVq6rSw4vPu7xgeiXKjvPluJ3bdwJY3XeC1XxiIjoVQhjMqAuCP gwtA== 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=QdQV+TtwR7nUQa2nhbCkXbp692jip7xowWS6qqziPL4=; b=WuFsal10qvSv16UBBE0owOU1KaHHUo5mOdHO+oX5a/hcof28/5mJgWUlotbHrpPLRh ZPDLAqV6Lgc6sPAuH+kxH9u626TTCrrzduJKxlzA42+WV8hDLu7/hrIlTziWrnKKCcwt JxZsGkjnfIuqgER4+mzhY0cmgd8RLsF4B/unabmsvRvAOqrk05hOgf3jX4w5xVqBoFpx BpNIVRdszSZViCQXqp42r8zUwsl6IurXsZOvdCljv/GauN60mzW5dSo7L+A29oW4HYxI U/6zS9VTQmsNBqUvRnCfqspU6utho0EEGYh5gCUh6UMHRVS94I7chYl69VEPzqyPM02g axHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZMVgeJmn; 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 m23si6618480pgb.479.2018.11.28.02.45.27; Wed, 28 Nov 2018 02:45:42 -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=ZMVgeJmn; 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 S1728223AbeK1VpV (ORCPT + 99 others); Wed, 28 Nov 2018 16:45:21 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:42337 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728157AbeK1VpV (ORCPT ); Wed, 28 Nov 2018 16:45:21 -0500 Received: by mail-lf1-f65.google.com with SMTP id l10so18961948lfh.9 for ; Wed, 28 Nov 2018 02:44:07 -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=QdQV+TtwR7nUQa2nhbCkXbp692jip7xowWS6qqziPL4=; b=ZMVgeJmnzdhwXVO/Tc+cwfs1zPRRsyfkEXSjNq4CJulE1Y7IB3f1RF6O/Yf+Pa26eP BF4JOzEd3Q/nZc8CM+XXlATF8nZc1RYpsvTA4sxn41UAdlqkofMDwRG+vVJaWIYmeQgb vXVCIAVp+/wg7h7t/JKe222qjV155CYc9ou08= 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=QdQV+TtwR7nUQa2nhbCkXbp692jip7xowWS6qqziPL4=; b=IlYT8t4ohT/M66KERBZJTBcUS2b2f6itEa3mQKmIvh9AQN4JoxcuJpIH9n18yMOJpg tTyLEpn7JxqXCFfM6UsXYtDQ/L8PLLmEgpOBXzq/9VeWJtMqL7rdUBm4bU3wp6yjvrd6 JRMWgHged3dLKLmbVYj1RYkcavcc6h354Cvy93xK+ijv+iIASf8uR9MjLOnJBTYOowd8 d6azyVNWHEwKLTIriVSxoR7eh/wJAfhqCHCzpYAwYOFcqYkwxRJCPY0mklsCy9gATmCa 3HIxMbZtfhjtHELdDJ5Hc3OiPNLyl75HKdPCsOqYFmRvddHCMG3qHYuMl1B9s2ARpgOv 70gQ== X-Gm-Message-State: AGRZ1gLsuMX0tO8mHxturHQlJfSRlUcDWgE/xQbjMoclTId0MSYOPBtD 8N3XrprBCgoSu7non+z3j4fnfQ== X-Received: by 2002:a19:5e5d:: with SMTP id z29mr20746732lfi.105.1543401846138; Wed, 28 Nov 2018 02:44:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:05 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 05/10] regulator: max8973: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:45 +0100 Message-Id: <20181128104350.31902-6-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: e7d2be696faa ("regulator: max8973: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/max8973-regulator.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index e7a58b509032..6e11324cb9cf 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -632,7 +632,7 @@ static int max8973_probe(struct i2c_client *client, struct max8973_chip *max; bool pdata_from_dt = false; unsigned int chip_id; - struct gpio_desc *gpiod; + struct gpio_desc *gpiod = NULL; enum gpiod_flags gflags; int ret; @@ -759,9 +759,9 @@ static int max8973_probe(struct i2c_client *client, else gflags = GPIOD_OUT_LOW; gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - gpiod = devm_gpiod_get_optional(&client->dev, - "maxim,enable", - gflags); + gpiod = gpiod_get_optional(&client->dev, + "maxim,enable", + gflags); if (IS_ERR(gpiod)) return PTR_ERR(gpiod); if (gpiod) { @@ -798,6 +798,8 @@ static int max8973_probe(struct i2c_client *client, ret = max8973_init_dcdc(max, pdata); if (ret < 0) { + if (gpiod) + gpiod_put(gpiod); dev_err(max->dev, "Max8973 Init failed, err = %d\n", ret); return ret; } @@ -811,6 +813,8 @@ static int max8973_probe(struct i2c_client *client, /* Register the regulators */ rdev = devm_regulator_register(&client->dev, &max->desc, &config); if (IS_ERR(rdev)) { + if (gpiod) + gpiod_put(gpiod); ret = PTR_ERR(rdev); dev_err(max->dev, "regulator register failed, err %d\n", ret); return ret; -- 2.19.1