From patchwork Wed Jul 28 15:31:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 114840 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SFWKiH021155 for ; Wed, 28 Jul 2010 15:32:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755242Ab0G1Pb7 (ORCPT ); Wed, 28 Jul 2010 11:31:59 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:35205 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754501Ab0G1Pb6 (ORCPT ); Wed, 28 Jul 2010 11:31:58 -0400 Received: from dlep33.itg.ti.com ([157.170.170.112]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o6SFVpG0015916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Jul 2010 10:31:51 -0500 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id o6SFVot5011856; Wed, 28 Jul 2010 10:31:50 -0500 (CDT) Received: from dlee73.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o6SFVosc006751; Wed, 28 Jul 2010 10:31:50 -0500 (CDT) Received: from [128.247.74.250] (128.247.74.250) by dlee73.ent.ti.com (157.170.170.88) with Microsoft SMTP Server id 8.1.358.0; Wed, 28 Jul 2010 10:31:50 -0500 Message-ID: <4C504D66.8090302@ti.com> Date: Wed, 28 Jul 2010 10:31:50 -0500 From: Nishanth Menon User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: "Ramos Falcon, Ernesto" CC: "gregkh@suse.de" , "Ramirez Luna, Omar" , "ohad@wizery.com" , "ameya.palande@nokia.com" , "felipe.contreras@nokia.com" , "Guzman Lugo, Fernando" , "linux-kernel@vger.kernel.org" , "andy.shevchenko@gmail.com" , "linux-omap@vger.kernel.org" Subject: Re: [PATCH 2/5] staging:ti dspbridge: remove unnecessary check for NULL pointer in cmm.c References: <1280328052-31292-1-git-send-email-ernesto@ti.com> <1280328052-31292-2-git-send-email-ernesto@ti.com> <1280328052-31292-3-git-send-email-ernesto@ti.com> <4C504719.3020007@ti.com> In-Reply-To: <4C504719.3020007@ti.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]); Wed, 28 Jul 2010 15:32:20 +0000 (UTC) diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c index 8e808d9..1a4ebca 100644 --- a/drivers/staging/tidspbridge/pmgr/cmm.c +++ b/drivers/staging/tidspbridge/pmgr/cmm.c @@ -984,27 +984,6 @@ int cmm_xlator_create(struct cmm_xlatorobject **xlator, } /* - * ======== cmm_xlator_delete ======== - * Purpose: - * Free the Xlator resources. - * VM gets freed later. - */ -int cmm_xlator_delete(struct cmm_xlatorobject *xlator, bool force) -{ - struct cmm_xlator *xlator_obj = (struct cmm_xlator *)xlator; - int status = 0; - - DBC_REQUIRE(refs > 0); - - if (xlator_obj) - kfree(xlator_obj); - else - status = -EFAULT; - - return status; -} - -/* * ======== cmm_xlator_alloc_buf ======== */ void *cmm_xlator_alloc_buf(struct cmm_xlatorobject *xlator, void *va_buf, diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c index 9f07c81..0c39288 100644 --- a/drivers/staging/tidspbridge/rmgr/node.c +++ b/drivers/staging/tidspbridge/rmgr/node.c @@ -2503,7 +2503,6 @@ static void delete_node(struct node_object *hnode, struct process_context *pr_ctxt) { struct node_mgr *hnode_mgr; - struct cmm_xlatorobject *xlator; struct bridge_drv_interface *intf_fxns; u32 i; enum node_type node_type; @@ -2521,7 +2520,6 @@ static void delete_node(struct node_object *hnode, hnode_mgr = hnode->hnode_mgr; if (!hnode_mgr) goto func_end; - xlator = hnode->xlator; node_type = node_get_type(hnode); if (node_type != NODE_DEVICE) { node_msg_args = hnode->create_args.asa.node_msg_args; @@ -2617,10 +2615,7 @@ static void delete_node(struct node_object *hnode, hnode->dcd_props.obj_data.node_obj.pstr_i_alg_name = NULL; /* Free all SM address translator resources */ - if (xlator) { - (void)cmm_xlator_delete(xlator, true); /* force free */ - xlator = NULL; - } + kfree(hnode->xlator); kfree(hnode->nldr_node_obj); hnode->nldr_node_obj = NULL; diff --git a/drivers/staging/tidspbridge/rmgr/strm.c b/drivers/staging/tidspbridge/rmgr/strm.c index 73888e3..05a8d13 100644 --- a/drivers/staging/tidspbridge/rmgr/strm.c +++ b/drivers/staging/tidspbridge/rmgr/strm.c @@ -844,14 +844,8 @@ static int delete_strm(struct strm_object *stream_obj) status = (*intf_fxns->pfn_chnl_close) (stream_obj->chnl_obj); /* Free all SM address translator resources */ - if (DSP_SUCCEEDED(status)) { - if (stream_obj->xlator) { - /* force free */ - (void)cmm_xlator_delete(stream_obj-> - xlator, - true); - } - } + if (DSP_SUCCEEDED(status)) + kfree(stream_obj->xlator); } kfree(stream_obj); } else {