From patchwork Fri Jun 12 09:19:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6596421 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 019BF9F399 for ; Fri, 12 Jun 2015 09:19:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4030720650 for ; Fri, 12 Jun 2015 09:19:40 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B7E8E20373 for ; Fri, 12 Jun 2015 09:19:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2E0F5266826; Fri, 12 Jun 2015 11:19:37 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 0D09A2667E4; Fri, 12 Jun 2015 11:19:29 +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 CFE462667F6; Fri, 12 Jun 2015 11:19:27 +0200 (CEST) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by alsa0.perex.cz (Postfix) with ESMTP id 495BF266723 for ; Fri, 12 Jun 2015 11:19:20 +0200 (CEST) Received: by pabqy3 with SMTP id qy3so19520920pab.3 for ; Fri, 12 Jun 2015 02:19:19 -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=uQ2Th99xykh/fGEAWq3fOC2sgpfia4qGAPh9DdTS7v4=; b=C22VwNkyP/5U/QhgFmecQy3IHUJIMW5FoMg9oYFjNoW0+S2vTaQEQ8gTX8I8qX1Xay EM3PULI5anMIU4mxytucCa4+eC2qSkwysuLNNtFAklRjIUZvPLyb4+et/BF+6gnN+6gD 5gE+kJvChzSopkSIgTSzajwxIptlzW7x5mG4oaoWWXLTa0EEBUrek/O1XFn0oazPBVcX zNOUmi1KRUCBQdOX+jg/fGurLks23T05xCq6L312V2sB/snpPKfDUSftTxUCuUmzBXwz my1m0LsUasi2JoD7zeoolqFLJZEP4TlP51B6jEW2dxVguHHRBYWrTCJpLCaKLYamWL2x brRw== X-Gm-Message-State: ALoCoQmbV6DtFWmj35jZug9N71xUxUoaQ8+UYxlCscidqUjHyXIV7xMIIsI5wjoErHChzSX6gatH X-Received: by 10.70.109.131 with SMTP id hs3mr21795502pdb.40.1434100758999; Fri, 12 Jun 2015 02:19:18 -0700 (PDT) Received: from phoenix.local (118-171-143-100.dynamic.hinet.net. [118.171.143.100]) by mx.google.com with ESMTPSA id v6sm2992270pdq.80.2015.06.12.02.19.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 02:19:18 -0700 (PDT) Message-ID: <1434100755.7458.1.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Fri, 12 Jun 2015 17:19:15 +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] ASoC: rt5645: Use devm_gpiod_get_optional for hp-detect 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 Since hp-detect is optional, use devm_gpiod_get_optional instead. In additional, it should return error if devm_gpiod_get_optional fails. Signed-off-by: Axel Lin --- sound/soc/codecs/rt5645.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 7d04b1a..04d9ff8 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3255,11 +3255,12 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, } } - rt5645->gpiod_hp_det = devm_gpiod_get(&i2c->dev, "hp-detect", GPIOD_IN); + rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect", + GPIOD_IN); if (IS_ERR(rt5645->gpiod_hp_det)) { - rt5645->gpiod_hp_det = NULL; dev_err(&i2c->dev, "failed to initialize gpiod\n"); + return PTR_ERR(rt5645->gpiod_hp_det); } rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap);