From patchwork Thu Oct 16 07:42:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5088731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9090D9F2BA for ; Thu, 16 Oct 2014 07:46:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BCA1020176 for ; Thu, 16 Oct 2014 07:46:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1756200E8 for ; Thu, 16 Oct 2014 07:46:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xefjf-0004LL-Rc; Thu, 16 Oct 2014 07:44:35 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xefhs-0003GY-9K for linux-arm-kernel@lists.infradead.org; Thu, 16 Oct 2014 07:42:46 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDJ005GR1JCNC30@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 16 Oct 2014 08:45:12 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-8b-543f76dcaa54 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 8B.6F.15956.CD67F345; Thu, 16 Oct 2014 08:42:20 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NDJ00HB61E86L90@eusync4.samsung.com>; Thu, 16 Oct 2014 08:42:20 +0100 (BST) From: Krzysztof Kozlowski To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Linus Walleij , Samuel Ortiz , Lee Jones , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Krzysztof Kozlowski , Konrad Rzeszutek Wilk , "Rafael J. Wysocki" , Lv Zheng , Bjorn Helgaas , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v2 5/7] power: 88pm860x_charger: Decrement the power supply's device reference counter Date: Thu, 16 Oct 2014 09:42:05 +0200 Message-id: <1413445327-24862-6-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1413445327-24862-1-git-send-email-k.kozlowski@samsung.com> References: <1413445327-24862-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRmVeSWpSXmKPExsVy+t/xa7p3yuxDDB4dUbc4uFXTYuOM9awW S5oyLCY9ec9sMXHlZGaLaRvFLV6/MLRYtvgpo8XZpjfsFve/HmW0mPJnOZPFpsfXWC0u75rD ZvG59wijxcelG1gt1h65y25x6cACJou7p46yWTxe8Zbd4nQ3q8Xp3SUWmzdNZbb4seExq4O4 x4T+T4weO2fdZfdYsKnUY/MKLY/Fe14yeWxa1cnmcefaHjaPd+fOsXvMOxnosXlJvcfHp7dY PN7vu8rm0bdlFaPHitXf2T0+b5LzONHyhTVAIIrLJiU1J7MstUjfLoEr4/qUoILd3BVrJ05k b2A8zNnFyMkhIWAiMfvhTFYIW0ziwr31bCC2kMBSRomfq7i6GLmA7D4miQs7pzKDJNgEjCU2 L1/CBpIQEdjEKrFtxQImEIdZ4DqjxOqrt9lBqoQFMiSWr5gLNpZFQFXi2pXnQEUcHLwC7hKr d2RAbJOTOHlsMlgJp4CHxP/euUwQm90l7r5pZ53AyLuAkWEVo2hqaXJBcVJ6rpFecWJucWle ul5yfu4mRkg8fd3BuPSY1SFGAQ5GJR5ejWD7ECHWxLLiytxDjBIczEoivM2FQCHelMTKqtSi /Pii0pzU4kOMTBycUg2MSYUWHx+v815klCxqnfbF8saX348ulClK8hWYHnA9E5R1pv/F0UxL 8ZLMz5ZBLpZf508I5jatuHzu+A3GdebvlirbORjUlD6faOr0IHVfRVOOe4qnca7PdOH/XEVO NzofMOiWHV7A84XRWMPt+vu/QjJ8E5aflwqbZSS59FV/ZHzt2R8u7yYqsRRnJBpqMRcVJwIA dUKD+YUCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141016_004244_512613_720B8B2B X-CRM114-Status: GOOD ( 10.90 ) X-Spam-Score: -5.0 (-----) Cc: Bartlomiej Zolnierkiewicz , Kyungmin Park , Anton Vorontsov , Pavel Machek , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use power_supply_put() to decrement the power supply's device reference counter. Signed-off-by: Krzysztof Kozlowski Acked-by: Pavel Machek --- drivers/power/88pm860x_charger.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c index 534b3e2e3487..48aa0d829cb0 100644 --- a/drivers/power/88pm860x_charger.c +++ b/drivers/power/88pm860x_charger.c @@ -298,13 +298,18 @@ static int set_charging_fsm(struct pm860x_charger_info *info) return -EINVAL; ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, &data); - if (ret) + if (ret) { + power_supply_put(psy); return ret; + } vbatt = data.intval / 1000; ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, &data); - if (ret) + if (ret) { + power_supply_put(psy); return ret; + } + power_supply_put(psy); mutex_lock(&info->lock); info->present = data.intval; @@ -447,6 +452,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data) set_charging_fsm(info); out: + power_supply_put(psy); return IRQ_HANDLED; } @@ -507,6 +513,7 @@ static irqreturn_t pm860x_done_handler(int irq, void *data) out: mutex_unlock(&info->lock); + power_supply_put(psy); dev_dbg(info->dev, "%s, Allowed: %d\n", __func__, info->allowed); set_charging_fsm(info);