From patchwork Thu Sep 20 14:47:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1486231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 42E45DF2D2 for ; Thu, 20 Sep 2012 14:51:16 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TEi3b-0000xe-3J; Thu, 20 Sep 2012 14:48:47 +0000 Received: from mail-wi0-f171.google.com ([209.85.212.171]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TEi2d-0000Lw-DR for linux-arm-kernel@lists.infradead.org; Thu, 20 Sep 2012 14:47:51 +0000 Received: by wibhq4 with SMTP id hq4so570561wib.0 for ; Thu, 20 Sep 2012 07:47:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=0pTS9504m3U3a8p5SCnguIdeqK+EH3rkpP+k6zhMpb4=; b=E/GxDwpMmD0VV2idKJe5nvJeSzWbF5e7FsDAHBibSNh/fma4fp1e/w6TB6LPiGsdHt +2KkeShBzcLddBXWeDmwTYHCrmGyylfQg9px2I3ErwGk9wTOAVd3hgR/ee1qbk8oazFD W4f7Ov2hpmW0CJeemlV8ytBDQi+x9ZgLyC77BWvtrNxTYOwaVa2jDJNnGaqSWoP8mtnE P4MrKf9nbA4NQMoEtnT9OWHbiw8vKJL7Pyc63YyiIvYdktipUVVIVWySLfSXyXD8lk9+ TTqR5ft5EkQaXbl6gT5jgJ2K2z79ybghu37JlTEkIHHP9wWh5CwQcYkZkazrwtLBlfCr H0Zg== Received: by 10.180.77.34 with SMTP id p2mr6556666wiw.0.1348152465480; Thu, 20 Sep 2012 07:47:45 -0700 (PDT) Received: from localhost.localdomain (179.59-66-87.adsl-dyn.isp.belgacom.be. [87.66.59.179]) by mx.google.com with ESMTPS id l6sm32938018wiz.4.2012.09.20.07.47.44 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 07:47:45 -0700 (PDT) From: Jean Pihet To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tony@atomide.com, Anton Vorontsov , Kevin Hilman , J Keerthy Subject: [PATCH 1/2] ARM: OMAP: SmartReflex: fix error path in init function Date: Thu, 20 Sep 2012 16:47:32 +0200 Message-Id: <1348152453-30532-2-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1348152453-30532-1-git-send-email-j-pihet@ti.com> References: <1348152453-30532-1-git-send-email-j-pihet@ti.com> X-Gm-Message-State: ALoCoQludei1nXZ2tUYcQTv9MP3REeCOIvTnsNgnpkAyJOStRkvWXrO1tDf7NM3aFk5fEylEspBV X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.171 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jean Pihet X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Fix the error handling path in omap_sr_probe to correctly de-allocate resources in case of problems. Signed-off-by: Jean Pihet --- drivers/power/avs/smartreflex.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c index 44efc6e..92f6728 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c @@ -928,7 +928,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) if (!sr_info->base) { dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); ret = -ENOMEM; - goto err_release_region; + goto err_free_name; } if (irq) @@ -967,7 +967,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", __func__); ret = PTR_ERR(sr_info->dbg_dir); - goto err_free_name; + goto err_debugfs; } (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, @@ -1011,11 +1011,11 @@ static int __init omap_sr_probe(struct platform_device *pdev) err_debugfs: debugfs_remove_recursive(sr_info->dbg_dir); -err_free_name: - kfree(sr_info->name); err_iounmap: list_del(&sr_info->node); iounmap(sr_info->base); +err_free_name: + kfree(sr_info->name); err_release_region: release_mem_region(mem->start, resource_size(mem)); err_free_devinfo: