From patchwork Mon Jan 5 15:48:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5568811 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B49ABF6C3 for ; Mon, 5 Jan 2015 15:49:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 32AB320166 for ; Mon, 5 Jan 2015 15:49:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CAFDA20121 for ; Mon, 5 Jan 2015 15:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754230AbbAEPsb (ORCPT ); Mon, 5 Jan 2015 10:48:31 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:55683 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754190AbbAEPs2 (ORCPT ); Mon, 5 Jan 2015 10:48:28 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NHP007JJO3F3140@mailout4.w1.samsung.com>; Mon, 05 Jan 2015 15:52:27 +0000 (GMT) X-AuditID: cbfec7f4-b7f126d000001e9a-cf-54aab249ac49 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id A6.74.07834.942BAA45; Mon, 05 Jan 2015 15:48:25 +0000 (GMT) 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 <0NHP00HBJNWDWI80@eusync4.samsung.com>; Mon, 05 Jan 2015 15:48:25 +0000 (GMT) From: Krzysztof Kozlowski To: "Rafael J. Wysocki" , Len Brown , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Pavel Machek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [RFC PATCHv2 17/19] power: bq2415x_charger: Decrement the power supply's device reference counter Date: Mon, 05 Jan 2015 16:48:00 +0100 Message-id: <1420472882-10463-18-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1420472882-10463-1-git-send-email-k.kozlowski@samsung.com> References: <1420472882-10463-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xa7qem1aFGHybb2Ax6cl7ZouJKycz W7x+YWix8+FbNovl+/oZLTY9vsZqcXnXHDaLz71HGC3unjrKZnHm9CVWi9O7Sxy4PXbOusvu sXmFlsemVZ1sHpuX1HtsudrO4tG3ZRWjx4rV39k9Pm+SC+CI4rJJSc3JLEst0rdL4Mr437ub teA9R8WTZw9ZGxjPsncxcnJICJhIXFrznQnCFpO4cG89WxcjF4eQwFJGiV+9x5kgnD4miYn7 37GAVLEJGEtsXr4ErEpE4AmTxPTWk2AJZgFDiZ/v/oCNFRbIkXg+fSVQnIODRUBVYst+G5Aw r4CHxNyGTkaIbXISJ49NZgWxOYHiTX8vgI0REnCX+PDsF+sERt4FjAyrGEVTS5MLipPScw31 ihNzi0vz0vWS83M3MUKC8ssOxsXHrA4xCnAwKvHwepxYGSLEmlhWXJl7iFGCg1lJhPdV+qoQ Id6UxMqq1KL8+KLSnNTiQ4xMHJxSDYw1Vg2hXvf/a+RGRE2fvzOgtbE03W8CV31MezCTbM35 +OSr7UvquuwCtP7/Xrxw3+6G65rMGwLK3zDN3/DN5evEZ6sL1z04eKJqn4lEwuzSH7nFdWud Pj3921vlmyAu97/muuJzn4+fZE5pbGLpcSh9Ifv4e72S5rIbiq7FvOJTueZP+LRa46ISS3FG oqEWc1FxIgCDdnbQKAIAAA== Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 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);