From patchwork Sun May 16 15:45:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 99962 X-Patchwork-Delegate: omar.ramirez@ti.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4GFjFpi024839 for ; Sun, 16 May 2010 15:45:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752555Ab0EPPpO (ORCPT ); Sun, 16 May 2010 11:45:14 -0400 Received: from fg-out-1718.google.com ([72.14.220.157]:52300 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752615Ab0EPPpM (ORCPT ); Sun, 16 May 2010 11:45:12 -0400 Received: by fg-out-1718.google.com with SMTP id d23so2359655fga.1 for ; Sun, 16 May 2010 08:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=11KHOz6XTB0clLyYWF8RYyVArUFD+wDNkPtBNxlZKB0=; b=nSI4Gtcsf9TuCHDeh2OxSEYjKB/Gk/4xXjd/dBi6AL26fJ/X6szWnBg8LtiGs80udD 8iJCbUvkD9jhhWyvF5+K/mmmCO5VNFCHcgMBRRD2ieQ3AfhdYlUFSdqOavwWGIP914kB YuY8Jlr2YSGoO+v7CBMjFYKSGwrLLnI3UN5lo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=KeRHmB1z7e4vBks201pDtFTnAUMSYdWRvv0KIQ0JnQyelhANR2/jk6LUNpjxfgqRmW V5vvdV29wUCmPYywHzUBbv0k71gIhBF/mzGRIhj5WxhnrqZiivjp02G+WBWZ5z9JFvWC OwAjVwmEKG+pwOHBQVrmZmZkfvOGN1mObzJRM= Received: by 10.87.8.4 with SMTP id l4mr6821872fgi.1.1274024711531; Sun, 16 May 2010 08:45:11 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id d6sm8306371fga.8.2010.05.16.08.45.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 16 May 2010 08:45:11 -0700 (PDT) From: Felipe Contreras To: linux-omap Cc: Omar Ramirez Luna , Felipe Contreras Subject: [PATCH 2/4] dspbridge: dev: fix dev_create_device() Date: Sun, 16 May 2010 18:45:00 +0300 Message-Id: <1274024702-20961-3-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1274024702-20961-1-git-send-email-felipe.contreras@gmail.com> References: <1274024702-20961-1-git-send-email-felipe.contreras@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 16 May 2010 15:45:15 +0000 (UTC) diff --git a/drivers/dsp/bridge/pmgr/dev.c b/drivers/dsp/bridge/pmgr/dev.c index c85a4fa..4ba8197 100644 --- a/drivers/dsp/bridge/pmgr/dev.c +++ b/drivers/dsp/bridge/pmgr/dev.c @@ -149,9 +149,11 @@ dsp_status dev_create_device(OUT struct dev_object **phDevObject, status = drv_request_bridge_res_dsp((void *)&host_res); - if (DSP_FAILED(status)) + if (DSP_FAILED(status)) { dev_dbg(bridge, "%s: Failed to reserve bridge resources\n", __func__); + goto leave; + } /* Get the WMD interface functions */ bridge_drv_entry(&drv_fxns, driver_file_name); @@ -256,20 +258,20 @@ dsp_status dev_create_device(OUT struct dev_object **phDevObject, else INIT_LIST_HEAD(&dev_obj->proc_list->head); } +leave: /* If all went well, return a handle to the dev object; * else, cleanup and return NULL in the OUT parameter. */ if (DSP_SUCCEEDED(status)) { *phDevObject = dev_obj; } else { - kfree(dev_obj->proc_list); - - if (dev_obj && dev_obj->cod_mgr) - cod_delete(dev_obj->cod_mgr); - - if (dev_obj && dev_obj->dmm_mgr) - dmm_destroy(dev_obj->dmm_mgr); - - kfree(dev_obj); + if (dev_obj) { + kfree(dev_obj->proc_list); + if (dev_obj->cod_mgr) + cod_delete(dev_obj->cod_mgr); + if (dev_obj->dmm_mgr) + dmm_destroy(dev_obj->dmm_mgr); + kfree(dev_obj); + } *phDevObject = NULL; }