From patchwork Sat Jul 25 02:23:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6863431 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8E6E1C05AC for ; Sat, 25 Jul 2015 02:24:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3568205C1 for ; Sat, 25 Jul 2015 02:24:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8588B20573 for ; Sat, 25 Jul 2015 02:24:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0D2EF265E62; Sat, 25 Jul 2015 04:24:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 3852426068D; Sat, 25 Jul 2015 04:23:55 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A44652606AC; Sat, 25 Jul 2015 04:23:53 +0200 (CEST) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by alsa0.perex.cz (Postfix) with ESMTP id 7CF1B260651 for ; Sat, 25 Jul 2015 04:23:46 +0200 (CEST) Received: by pachj5 with SMTP id hj5so22491015pac.3 for ; Fri, 24 Jul 2015 19:23:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=+CBXqxk9hOAJrvxspjJpkSF2XydKFrxf1HQWNhWtePw=; b=NsnDShjfbTlEQjKGbzeozpdAt+lkJFdfrZdQZPVe5knB6BEZCAx91+9MZRg+PbtVTM qbW4Ub1/fPdBUtzB/9j7tHArN+eUQkwUMYoRHUxw4LsaA3FRhFxdVcgTVUondtHirg/X VUij9OU3W7tjO9A4gl3GhQmP5I32r1o8gDgKZa7b2+ljY14i0WpdQP6R6hy7pD9Xot35 dlQQ1U4TRny4w1W9F/kw3BQ+3TuesyhC/blnqb/imwePzZiJ0SuEZRzwU9VWEmEumJRp T+OYzdEoiiOuYdZCm1ZH8GEZ77w3jRVQIVK4t3VSaxrbd+luphom8CMcrx8o0RC4jDH3 Ypfg== X-Gm-Message-State: ALoCoQmVi8hAqDGgu74JVz+pHKauWmhkhRrGECgFTwanrIxFK8LPMfNBPXdjaV50t4HNXC+xdvUv X-Received: by 10.66.62.163 with SMTP id z3mr37851568par.12.1437791024929; Fri, 24 Jul 2015 19:23:44 -0700 (PDT) Received: from phoenix.local (36-239-216-55.dynamic-ip.hinet.net. [36.239.216.55]) by smtp.gmail.com with ESMTPSA id pc9sm16904947pdb.6.2015.07.24.19.23.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 19:23:43 -0700 (PDT) Message-ID: <1437791020.12775.1.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Sat, 25 Jul 2015 10:23:40 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Oder Chiou , Bard Liao , alsa-devel@alsa-project.org, Liam Girdwood Subject: [alsa-devel] [PATCH v2] ASoC: rt5677: Return error if devm_gpiod_get_optional return ERR_PTR X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP If devm_gpiod_get_optional() return ERR_PTR, it means something wrong so request gpio fails. We had better return error in such case. Signed-off-by: Axel Lin --- sound/soc/codecs/rt5677.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 8d70911..83e25a3 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -5133,14 +5133,14 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, if (IS_ERR(rt5677->pow_ldo2)) { ret = PTR_ERR(rt5677->pow_ldo2); dev_err(&i2c->dev, "Failed to request POW_LDO2: %d\n", ret); - rt5677->pow_ldo2 = 0; + return ret; } rt5677->reset_pin = devm_gpiod_get_optional(&i2c->dev, "realtek,reset", GPIOD_OUT_HIGH); if (IS_ERR(rt5677->reset_pin)) { ret = PTR_ERR(rt5677->reset_pin); dev_err(&i2c->dev, "Failed to request RESET: %d\n", ret); - rt5677->reset_pin = 0; + return ret; } if (rt5677->pow_ldo2 || rt5677->reset_pin) {