From patchwork Wed May 17 12:11:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9731005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F660602DB for ; Wed, 17 May 2017 12:11:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 712B92875B for ; Wed, 17 May 2017 12:11:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 656D62877B; Wed, 17 May 2017 12:11:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E14DE2875B for ; Wed, 17 May 2017 12:11:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751789AbdEQMLm (ORCPT ); Wed, 17 May 2017 08:11:42 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33341 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753661AbdEQMLl (ORCPT ); Wed, 17 May 2017 08:11:41 -0400 Received: by mail-pf0-f196.google.com with SMTP id f27so1550089pfe.0 for ; Wed, 17 May 2017 05:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UQUVQUPyKOMG/nhAE/KmxnI5b1lYRTPrJinq9ebnEkk=; b=CBpOgZVgdslO2usm974DnGtVVWKT/ahpaI1pOE5ul3rYeoF3pCyV9LPqinlOqSGdQ8 yNlESXsXGJKgX6ffjKgRkMxcyr4mvx0UoQ1+rE4c2r//ksJ+pyzyqrK5nRQ3/0WJi+8I VA3YZf92vqZHBz/f3ToEuknMuGEHp0Tk2RVKyiHUgTPHROhO+/7qoBzzSYeynm3Xkj8B HccMxMd6+qxurFBXaREfCgY/8lm3b9Er+YW3dreNtfNBglpkqZiRTqpLBjzM7zOMvYUS I8bn474pyU1FElyg2CuMMRwoOjTmSDeDTPWp7LZ7fiACKOgmf9LPD2SbVezpymFeyuJT KkcA== 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:mime-version :content-transfer-encoding; bh=UQUVQUPyKOMG/nhAE/KmxnI5b1lYRTPrJinq9ebnEkk=; b=WkYR9+yVnXoidopeg1XROvucBxV1cixHSv1PnNgi10ofoqxP1Pd0CVLrZEN6GJFIvk b4sGUGkfBXHlJWEaUD8dkufTQiM10BYY93wxdY6soQf5S327JGHq0AkSEyNfBscY0+hU zNY08aelNGP8YbRHqe4NUaknbhicPnfUzkEFmln7zUJU89vg6/7ulYoL/YIsHi0Pxkrz HZEW4Vrk4ESsMiZ17nTbcxZTgTh0EBswBQfjn9kiWGD4VaRzXc1mAdc0loJGPVvzvC0c 5A1oMv8W4MFfheS2Rzb1KmS4GaycGVBjFXt/rk4waiT0IuyFeuxiEWm1zE2s9eQAzj+N SdJg== X-Gm-Message-State: AODbwcD6iebcMchZSj6JQf+6UZYpqQRLFaxTwXpp7Ch2K6RO5qhTtV8x GCOZLQf0Jj+0hS8xfmg= X-Received: by 10.84.238.134 with SMTP id v6mr3954896plk.137.1495023100627; Wed, 17 May 2017 05:11:40 -0700 (PDT) Received: from 192.168.0.37 (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id k86sm3975538pfk.125.2017.05.17.05.11.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 May 2017 05:11:40 -0700 (PDT) From: Wei Yongjun To: Sebastian Reichel , Dmitry Torokhov Cc: Wei Yongjun , linux-pm@vger.kernel.org Subject: [PATCH -next] power: supply: ltc3651-charger: Fix wrong pointer passed to PTR_ERR() Date: Wed, 17 May 2017 12:11:32 +0000 Message-Id: <20170517121132.7052-1-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun PTR_ERR should access the value just tested by IS_ERR, otherwise the wrong error code will be returned. Signed-off-by: Wei Yongjun --- drivers/power/supply/ltc3651-charger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/ltc3651-charger.c b/drivers/power/supply/ltc3651-charger.c index 5f8d5c0..eea63ff 100644 --- a/drivers/power/supply/ltc3651-charger.c +++ b/drivers/power/supply/ltc3651-charger.c @@ -110,21 +110,21 @@ static int ltc3651_charger_probe(struct platform_device *pdev) ltc3651_charger->acpr_gpio = devm_gpiod_get(&pdev->dev, "lltc,acpr", GPIOD_IN); if (IS_ERR(ltc3651_charger->acpr_gpio)) { - ret = PTR_ERR(ltc3651_charger->charger); + ret = PTR_ERR(ltc3651_charger->acpr_gpio); dev_err(&pdev->dev, "Failed to acquire acpr GPIO: %d\n", ret); return ret; } ltc3651_charger->fault_gpio = devm_gpiod_get_optional(&pdev->dev, "lltc,fault", GPIOD_IN); if (IS_ERR(ltc3651_charger->fault_gpio)) { - ret = PTR_ERR(ltc3651_charger->charger); + ret = PTR_ERR(ltc3651_charger->fault_gpio); dev_err(&pdev->dev, "Failed to acquire fault GPIO: %d\n", ret); return ret; } ltc3651_charger->chrg_gpio = devm_gpiod_get_optional(&pdev->dev, "lltc,chrg", GPIOD_IN); if (IS_ERR(ltc3651_charger->chrg_gpio)) { - ret = PTR_ERR(ltc3651_charger->charger); + ret = PTR_ERR(ltc3651_charger->chrg_gpio); dev_err(&pdev->dev, "Failed to acquire chrg GPIO: %d\n", ret); return ret; }