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: 1497971 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BD903DF280 for ; Mon, 24 Sep 2012 14:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755681Ab2IXORD (ORCPT ); Mon, 24 Sep 2012 10:17:03 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:46855 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755657Ab2IXORB (ORCPT ); Mon, 24 Sep 2012 10:17:01 -0400 Received: by wibhq12 with SMTP id hq12so1946670wib.1 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=XUwUAjKMbabPm1DZ3ISBeV8tC+MlAI9WUDufxUE2wiCX5m2xQSjJWu/F2HKjQFbsTw v3PLVbO0f5wl6veXsM5cEipCA18iHl3NodvGa8R2Xv5mKkRGA+wopBmS7fyQ+KrLLhbf gOlC5SfpBw3cj3yYI1yGP06Zgiq2nM3/j6IP1lsj7o3eyoSqLjW6M2EKjoRihDOP+Ncg cwo/NvPX9ufQ/ndiPNIz3m9C/0+UWHblOpEz5BRVQAOMExNyZ6KRENL65vAaEsGxPV5U 4rwJntNemwURtTnh68+DqcTHvV5NqeeUvLAuwgyLKSjc/GEAx/nD4TPslAEIqQEWmTwI Ne6A== 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 Cc: Kevin Hilman , J Keerthy , Jean Pihet 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: ALoCoQlRwRFwbTKZcI4Zi6Z/X5SSUuQ65EZY1o1ED9XARKb4GrmYMlZtX1XLgxHVfq1ZONH7dVzh 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: