From patchwork Mon Sep 24 14:16:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1497991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 0D2283FC71 for ; Mon, 24 Sep 2012 14:19:40 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TG9TT-0002mn-Nz; Mon, 24 Sep 2012 14:17:27 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TG9T4-0002bV-I8 for linux-arm-kernel@lists.infradead.org; Mon, 24 Sep 2012 14:17:03 +0000 Received: by wibhn17 with SMTP id hn17so3513251wib.0 for ; Mon, 24 Sep 2012 07:17:00 -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=V3pjyC5sQXIZ4yaqpFuEbLvizEsqFVYyd1dXTvtsuvVTpWuwXhG69+WuhMSpEofCDr eEdKOycDb+w/seGErVUYfT5EDFi27oeJ0CkQvHyGkTPoiEylfehFeK8STxHBzZlV9x3L 2UBqg1LbMcDJQgYP/HyQGNFHeFp0e35d8i1epvDR2Gc26sxeMRcYYZ5KKZp68WS2YSn8 7KSRY3TXJUDf6LAX7g+i9LyxgO918SE+nvRdAvxbt7Eexc32DcI7h787SpzFOBW55ssE 65dSiW3KyeF1RFmvRczAv2+Evdj3/74GGcn2yOPkmNwpGYBoHZfHbCoXvTtp7WABjBZc EYpg== Received: by 10.180.76.69 with SMTP id i5mr14743823wiw.9.1348496220503; Mon, 24 Sep 2012 07:17:00 -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 hv8sm21524124wib.0.2012.09.24.07.16.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 07:16:59 -0700 (PDT) From: Jean Pihet To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tony@atomide.com, Anton Vorontsov Subject: [PATCH 1/2] ARM: OMAP: SmartReflex: fix error path in init function Date: Mon, 24 Sep 2012 16:16:40 +0200 Message-Id: <1348496201-6378-2-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1348496201-6378-1-git-send-email-j-pihet@ti.com> References: <1348152453-30532-1-git-send-email-j-pihet@ti.com> <1348496201-6378-1-git-send-email-j-pihet@ti.com> X-Gm-Message-State: ALoCoQkB2C08LLa+zbvTuL8CshWpQpABiuDpo0Zu1s6JkuglpbVYlDx/MdSU3UZ24YPrfHmArdBE 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.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Kevin Hilman , J Keerthy , 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: