From patchwork Fri Nov 5 17:01:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ionut Nicu X-Patchwork-Id: 304442 X-Patchwork-Delegate: omar.ramirez@ti.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA5H2M0w009263 for ; Fri, 5 Nov 2010 17:02:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753889Ab0KERCV (ORCPT ); Fri, 5 Nov 2010 13:02:21 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:57816 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752862Ab0KERCU (ORCPT ); Fri, 5 Nov 2010 13:02:20 -0400 Received: by bwz11 with SMTP id 11so2857773bwz.19 for ; Fri, 05 Nov 2010 10:02:19 -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=hOHSTRZUcy1Kc23Z+rdEaGVOxkPxS0aW6XUHr3dm8dA=; b=qdCsGV5ZmPbURm0gxlY+i4xdxiK5ll5UsvIguP9iJwn9qImkb5/62r/z4b6VyWRMFE oyW/X/fyhGT89hNEaykSVWbhM/JN9S0bMekZbLbAKhfTESOYz6GuFFQB/Rfoo9+I2zsd Glzt9hE62XHKkdpf5fsauQh37WyixrhI/gM0I= 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=GyDCCASeaWlj6t4mvkIvwxi0vNP5ZqjUfHFDoo4jCs15WVheOVGLINZwj109fir6aM GN3bqqWR682DxfzP1VfVc7WZ9fGNlby7fLykBnjuXkp5+Er/TxLnMrCMU3bHHVpShBAI VJTAeihLWsTZQlg/su2Fvjf1vtTWCU6szdvb0= Received: by 10.204.126.167 with SMTP id c39mr2032186bks.125.1288976539400; Fri, 05 Nov 2010 10:02:19 -0700 (PDT) Received: from localhost.localdomain (196-98-odb-svnet.titannet.ro [77.81.196.98]) by mx.google.com with ESMTPS id g8sm1174621bkg.23.2010.11.05.10.02.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 05 Nov 2010 10:02:18 -0700 (PDT) From: Ionut Nicu To: Greg Kroah-Hartman , Omar Ramirez Luna Cc: Fernando Guzman Lugo , Felipe Contreras , linux-omap , Ionut Nicu Subject: [PATCH v4 2/3] staging: tidspbridge: mgr_enum_node_info cleanup Date: Fri, 5 Nov 2010 19:01:49 +0200 Message-Id: <1288976510-25470-3-git-send-email-ionut.nicu@mindbit.ro> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1288976510-25470-1-git-send-email-ionut.nicu@mindbit.ro> References: <1288976510-25470-1-git-send-email-ionut.nicu@mindbit.ro> 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 (demeter1.kernel.org [140.211.167.41]); Fri, 05 Nov 2010 17:02:22 +0000 (UTC) diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c index 2eab6a5..16410a5 100644 --- a/drivers/staging/tidspbridge/rmgr/mgr.c +++ b/drivers/staging/tidspbridge/rmgr/mgr.c @@ -134,8 +134,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props, u32 undb_props_size, u32 *pu_num_nodes) { int status = 0; - struct dsp_uuid node_uuid, temp_uuid; - u32 temp_index = 0; + struct dsp_uuid node_uuid; u32 node_index = 0; struct dcd_genericobj gen_obj; struct mgr_object *pmgr_obj = NULL; @@ -149,24 +148,27 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props, *pu_num_nodes = 0; /* Get the Manager Object from the driver data */ if (!drv_datap || !drv_datap->mgr_object) { - status = -ENODATA; pr_err("%s: Failed to retrieve the object handle\n", __func__); - goto func_cont; - } else { - pmgr_obj = drv_datap->mgr_object; + return -ENODATA; } + pmgr_obj = drv_datap->mgr_object; DBC_ASSERT(pmgr_obj); /* Forever loop till we hit failed or no more items in the * Enumeration. We will exit the loop other than 0; */ - while (status == 0) { - status = dcd_enumerate_object(temp_index++, DSP_DCDNODETYPE, - &temp_uuid); - if (status == 0) { - node_index++; - if (node_id == (node_index - 1)) - node_uuid = temp_uuid; - + while (!status) { + status = dcd_enumerate_object(node_index++, DSP_DCDNODETYPE, + &node_uuid); + if (status) + break; + *pu_num_nodes = node_index; + if (node_id == (node_index - 1)) { + status = dcd_get_object_def(pmgr_obj->hdcd_mgr, + &node_uuid, DSP_DCDNODETYPE, &gen_obj); + if (status) + break; + /* Get the Obj def */ + *pndb_props = gen_obj.obj_data.node_obj.ndb_props; } } @@ -174,27 +176,6 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props, if (status > 0) status = 0; - if (!status) { - if (node_id > (node_index - 1)) { - status = -EINVAL; - } else { - status = dcd_get_object_def(pmgr_obj->hdcd_mgr, - (struct dsp_uuid *) - &node_uuid, DSP_DCDNODETYPE, - &gen_obj); - if (!status) { - /* Get the Obj def */ - *pndb_props = - gen_obj.obj_data.node_obj.ndb_props; - *pu_num_nodes = node_index; - } - } - } - -func_cont: - DBC_ENSURE((!status && *pu_num_nodes > 0) || - (status && *pu_num_nodes == 0)); - return status; }