From patchwork Tue Nov 4 15:10:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5228671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0AC77C11AC for ; Tue, 4 Nov 2014 15:13:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 445F820166 for ; Tue, 4 Nov 2014 15:13:51 +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 72BAC2012B for ; Tue, 4 Nov 2014 15:13:50 +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 1Xlflo-0006pj-PG; Tue, 04 Nov 2014 15:11:44 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XlflH-0006SG-3C for linux-arm-kernel@lists.infradead.org; Tue, 04 Nov 2014 15:11:11 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NEI00F8ZSYRS720@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 04 Nov 2014 15:13:39 +0000 (GMT) X-AuditID: cbfec7f5-b7f956d000005ed7-6c-5458ec7b27db Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 50.6A.24279.B7CE8545; Tue, 04 Nov 2014 15:10:51 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NEI00A4OSTTFF40@eusync1.samsung.com>; Tue, 04 Nov 2014 15:10:51 +0000 (GMT) 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 , 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 RESEND v2 6/7] power: bq2415x_charger: Decrement the power supply's device reference counter Date: Tue, 04 Nov 2014 16:10:35 +0100 Message-id: <1415113836-26098-7-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1415113836-26098-1-git-send-email-k.kozlowski@samsung.com> References: <1415113836-26098-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRmVeSWpSXmKPExsVy+t/xy7rVbyJCDPqf81oc3KppsXHGelaL JU0ZFpOevGe2mLhyMrPFtI3iFq9fGFosW/yU0eJs0xt2i/tfjzJaTPmznMli0+NrrBaXd81h s/jce4TR4uPSDawWa4/cZbe4dGABk8XdU0fZLB6veMtucbqb1eL07hKLzZumMlv82PCY1UHc Y0L/J0aPnbPusnss2FTqsXmFlsfiPS+ZPDat6mTzuHNtD5vHu3Pn2D3mnQz02Lyk3uPj01ss Hu/3XWXz6NuyitFjxerv7B6fN8l5nGj5whogEMVlk5Kak1mWWqRvl8CV8b93N2vBe46KJ88e sjYwnmXvYuTgkBAwkdi2Wa2LkRPIFJO4cG89WxcjF4eQwFJGiQvLD0I5fUwSS1ffZAKpYhMw lti8fAlYQkSgkVXi3NY3TCAOs0AHk8Ttlp2sIFXCAnkSi3/sYgRZwSKgKnFskhiIySvgLnHk WRDENjmJk8cmg1VzCnhI7Gz5zw5iCwGVvNm4nXUCI+8CRoZVjKKppckFxUnpuUZ6xYm5xaV5 6XrJ+bmbGCHx9HUH49JjVocYBTgYlXh4V8RHhAixJpYVV+YeYpTgYFYS4VV/DBTiTUmsrEot yo8vKs1JLT7EyMTBKdXAWPq8IqH0g0TZDonvldd49Noe6135HHOs5JqeU1mG/oyOhnur3rhb f2x7kOozWXGVZuOeQyfWTZYWu5bO/20P8xeVWXY9/zdHdzfoaLuGbfAWvh6eU/FgjsP6ex0z lJpuh01ZyLqyMvbSnmI/t99xM6e0bHwY1dYzPTv2dWquYNQG+Rr/50EflViKMxINtZiLihMB Ef+/sYUCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141104_071111_299112_F6A18914 X-CRM114-Status: GOOD ( 10.47 ) X-Spam-Score: -5.6 (-----) Cc: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Anton Vorontsov , Kyungmin Park , 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=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 (increased by power_supply_get_by_name() or power_supply_get_by_phandle()). Signed-off-by: Krzysztof Kozlowski Acked-by: Pavel Machek --- drivers/power/bq2415x_charger.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index 2f80de0410d9..00809dcdd34e 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c @@ -1686,6 +1686,8 @@ error_4: error_3: bq2415x_power_supply_exit(bq); error_2: + if (!IS_ERR(bq->notify_psy)) + power_supply_put(bq->notify_psy); kfree(name); error_1: mutex_lock(&bq2415x_id_mutex); @@ -1701,8 +1703,10 @@ static int bq2415x_remove(struct i2c_client *client) { struct bq2415x_device *bq = i2c_get_clientdata(client); - if (bq->notify_psy) + if (bq->notify_psy) { power_supply_unreg_notifier(&bq->nb); + power_supply_put(bq->notify_psy); + } bq2415x_sysfs_exit(bq); bq2415x_power_supply_exit(bq);