From patchwork Tue Oct 14 12:35:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5080191 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 D66D89F295 for ; Tue, 14 Oct 2014 12:41:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B72D20138 for ; Tue, 14 Oct 2014 12:41:16 +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 49C8C20127 for ; Tue, 14 Oct 2014 12:41:15 +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 1Xe1NR-0005zO-EY; Tue, 14 Oct 2014 12:38:57 +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 1Xe1Lx-000549-61 for linux-arm-kernel@lists.infradead.org; Tue, 14 Oct 2014 12:37:26 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) 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 <0NDF0036PPUQWE30@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 14 Oct 2014 13:40:02 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-e2-543d18f60c83 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 82.8C.25543.6F81D345; Tue, 14 Oct 2014 13:37:10 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NDF005XWPP45P40@eusync2.samsung.com>; Tue, 14 Oct 2014 13:37:10 +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 6/7] power: bq2415x_charger: Decrement the power supply's device reference counter Date: Tue, 14 Oct 2014 14:35:16 +0200 Message-id: <1413290117-13082-7-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1413290117-13082-1-git-send-email-k.kozlowski@samsung.com> References: <1413290117-13082-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t/xK7rfJGxDDF7flLc4uFXTYuOM9awW S5oyLCY9ec9sMXHlZGaLaRvFLV6/MLRYtvgpo8XZpjfsFve/HmW0mPJnOZPFpsfXWC0u75rD ZvG59wijxcelG1gt1h65y25x6cACJou7p46yWTxe8Zbd4nQ3q8Xp3SUWmzdNZbb4seExq4O4 x4T+T4weO2fdZfdYsKnUY/MKLY/Fe14yeWxa1cnmcefaHjaPd+fOsXvMOxnosXlJvcfHp7dY PN7vu8rm0bdlFaPHitXf2T0+b5LzONHyhTVAIIrLJiU1J7MstUjfLoEr49e9X6wFJzgq/mzd ytLAuJq9i5GTQ0LAROLrty+sELaYxIV769m6GLk4hASWMkr0n5zKDuH0MUl8/XidBaSKTcBY YvPyJWBVIgKbWCW2rVjABOIwC1xnlFh99TbYXGGBFIm/v8+BzWURUJXY2XIPzOYVcJfYtWA7 1G45iZPHJgPFOTg4BTwkJu5SAzGFgEpmPZOdwMi7gJFhFaNoamlyQXFSeq6hXnFibnFpXrpe cn7uJkZIRH3Zwbj4mNUhRgEORiUe3oJImxAh1sSy4srcQ4wSHMxKIrwKHLYhQrwpiZVVqUX5 8UWlOanFhxiZODilGhj7/P0t6286PXSv2rC4Q2emaMFW2eaM/9J7VxTnTvw9N8D7ZG9yMN+n CUZSiSKr7k9/IZHyqthxPvvt66FqLf7PuJ/N3rVl+YJX2bsmWEgE7mmUOc7Rnuk6l//0jthj nHLBft81gnnThZLEVQ9fjjTaGaKWtmqBWsbyl8p/Mj/3VE14maW6sU+JpTgj0VCLuag4EQAK pDazhgIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141014_053725_412777_B4559B76 X-CRM114-Status: GOOD ( 10.08 ) 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 (increased by power_supply_get_by_name() or power_supply_get_by_phandle()). Signed-off-by: Krzysztof Kozlowski --- 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 81a3a78b92d8..8bc9ca9e0275 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c @@ -1684,6 +1684,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); @@ -1699,8 +1701,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);