From patchwork Fri Mar 18 05:40:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 8616081 Return-Path: X-Original-To: patchwork-linux-pm@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 6E91FC0553 for ; Fri, 18 Mar 2016 05:42:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49D6B20483 for ; Fri, 18 Mar 2016 05:41:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F0F6203FB for ; Fri, 18 Mar 2016 05:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355AbcCRFlt (ORCPT ); Fri, 18 Mar 2016 01:41:49 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:19379 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753277AbcCRFlD (ORCPT ); Fri, 18 Mar 2016 01:41:03 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u2I5ePBx025477 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Mar 2016 05:40:25 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u2I5ePPG025462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 18 Mar 2016 05:40:25 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u2I5eOqp016335; Fri, 18 Mar 2016 05:40:25 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 17 Mar 2016 22:40:24 -0700 Date: Fri, 18 Mar 2016 08:40:16 +0300 From: Dan Carpenter To: Sebastian Reichel , Haojian Zhuang Cc: Dmitry Eremin-Solenikov , David Woodhouse , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] power/max8925: freeing wrong variable Message-ID: <20160318054016.GD2111@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 We were freeing "info->battery" instead of "info->usb", which leads to an OOps and a resource leak. The labels were wonky, "out_battery" did release the battery but out_usb did not release usb. I was introducing a call to free usb so it sort conflicted with existing misleading name. I renamed them. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index 57eb5c2..3b94620 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -540,14 +540,14 @@ static int max8925_power_probe(struct platform_device *pdev) info->usb = power_supply_register(&pdev->dev, &usb_desc, &psy_cfg); if (IS_ERR(info->usb)) { ret = PTR_ERR(info->usb); - goto out_usb; + goto out_unregister_ac; } info->usb->dev.parent = &pdev->dev; info->battery = power_supply_register(&pdev->dev, &battery_desc, NULL); if (IS_ERR(info->battery)) { ret = PTR_ERR(info->battery); - goto out_battery; + goto out_unregister_usb; } info->battery->dev.parent = &pdev->dev; @@ -560,9 +560,9 @@ static int max8925_power_probe(struct platform_device *pdev) max8925_init_charger(chip, info); return 0; -out_battery: - power_supply_unregister(info->battery); -out_usb: +out_unregister_usb: + power_supply_unregister(info->usb); +out_unregister_ac: power_supply_unregister(info->ac); out: return ret;