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: 1456751 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 23406402E1 for ; Fri, 14 Sep 2012 10:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759323Ab2INKPJ (ORCPT ); Fri, 14 Sep 2012 06:15:09 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:65502 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758497Ab2INKPH (ORCPT ); Fri, 14 Sep 2012 06:15:07 -0400 Received: by wibhi8 with SMTP id hi8so8067436wib.1 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=ZoAQ+yKSMsmNAADujDFw0jF4IzE2VzqZpADNzAve2bFEQo9UjILKI5mKEAtkJE22US ymynWBkPBf0wLhOSmz2RFHBr4007uAONA6rdUcdaAq9NlHSOrXWdY5ZEDq5d6OJp8tDA Pm0wm5PVdl4BKDqq9hASKmZeAl+m4OjnX8+MQPCacIdhqXbEBPXLqNKzOTEMc4XpfA33 3WJpMEeQTOjGG0Cc0ORA5A0Hk0vaYRpSU/lpZvFdCGSr1g7TGOf4lA4PneYAVwbTiGNM w9/7WnMSs/55AsD4Uq7s/3huYeYiYE3ZXPSTGVwAZk4rwFXzv1P8yAFq/L/TWhnOUz2a Kp9g== 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 Cc: J Keerthy , Jean Pihet 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: ALoCoQnP0+6Kt2Ktavb0mBgfbMuNZA1+1IsHEtj0RRKvD8AWGP8vcFGtY2p48mnz0z7Ud89ZSRNQ Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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: