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: 1486151 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7A4113FD40 for ; Thu, 20 Sep 2012 14:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755678Ab2ITOru (ORCPT ); Thu, 20 Sep 2012 10:47:50 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:59619 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932108Ab2ITOrq (ORCPT ); Thu, 20 Sep 2012 10:47:46 -0400 Received: by wgbdr13 with SMTP id dr13so529895wgb.1 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=DhJeTQs27RCRpMBptIbqVFIYqCeX2JrNRy2kSjG2mNXoYulOeLkDuvIfsFJ8qj3SAX UKFoRaFQp3X5GktsN5EbAfnt6RvPAIfBwxQCJSNHjQKECSPhH8GT3F33849sLGAkBJhn 61POc9UJ6EiZH9HJOtXNMRMwN3JvrBKx3M0YdRQBV1Js6rPKhtZSUbxqynmj5wmfo/2i WJJ5LwdlmaFroHCHimuVf4kowC6OTTSqX1n3VzNPCwpk2OvUfR+LZha2SpMHH9XY7zoM +9PSYq5sZMKUUT7M1/Bs6QiMqY8Y34PCZVhtgoIw95kotT3QjGrtczsW7ArIG4i6obXQ 6dkg== 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 Cc: Jean Pihet 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: ALoCoQms11V3MgQODk608lGJNzeuTAqwyLuZzCqXs3IWuplGNZLncLSHz4aC3TcPxt0vlIQGvE3J Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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: