From patchwork Fri Sep 14 10:14:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1456781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (unknown [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 30DAB40220 for ; Fri, 14 Sep 2012 10:36: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 1TCSvb-0001eS-0a; Fri, 14 Sep 2012 10:15:15 +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 1TCSvX-0001di-TY for linux-arm-kernel@lists.infradead.org; Fri, 14 Sep 2012 10:15:12 +0000 Received: by wibhn17 with SMTP id hn17so3403610wib.0 for ; Fri, 14 Sep 2012 03:15:06 -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:x-gm-message-state; bh=rl2cS4zxmA3Op7LnKnCBOnKTYOZ0CqBbF8eosrwHA6A=; b=nV/yvmy4leaeDALOC2uEL0K3Zg/FAM5eezxIDsdOxB/ZxHkB7oq2ADIGC0NTPSW084 XBOrRTk8hLHCcxJflIbs1DGQexQrmEenuKtzKGV5UJVLVKBHc4JGXghkZbeP3jmQQqRd DjGEM6fp6fvfyiY2cckC3WRL5Z4AzCUeUL9cCJ7o1AWeOHx3j9906AX7nCAONSsb8RVt LeZWf1oovZqTs7NQsI719Dkuk/axRKwT5FFJg8oKP0eOSWE8QZx1yVdFYCckKiNoNeUh 3GhSlGfEdKNVgRo7sPMcOwIddE9GNpUGDcWGnLxEZS4ppxvom8XTWrLmFIuzPbG3vrFt ICFQ== Received: by 10.180.74.33 with SMTP id q1mr47077592wiv.4.1347617706762; Fri, 14 Sep 2012 03:15:06 -0700 (PDT) Received: from localhost.localdomain (52.60-66-87.adsl-dyn.isp.belgacom.be. [87.66.60.52]) by mx.google.com with ESMTPS id cl8sm18171278wib.10.2012.09.14.03.15.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Sep 2012 03:15:06 -0700 (PDT) From: jean.pihet@newoldbits.com To: Tony Lindgren , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: OMAP: SmartReflex: fix error path in init function Date: Fri, 14 Sep 2012 12:14:54 +0200 Message-Id: <1347617694-367-1-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.7.6 X-Gm-Message-State: ALoCoQnq9QY4cOsws2MJLPwrDNQ0AmGj8M/fUKr2zBaSBnRYND6U5khGDfZxcLhPL2H79bJr2ncw 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: 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 From: Jean Pihet 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 734493d..a802f4c 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c @@ -911,7 +911,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) @@ -949,7 +949,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, @@ -993,11 +993,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: