From patchwork Fri Nov 5 15:15:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ionut Nicu X-Patchwork-Id: 304272 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 oA5FGAdA028013 for ; Fri, 5 Nov 2010 15:16:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753013Ab0KEPQJ (ORCPT ); Fri, 5 Nov 2010 11:16:09 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:39839 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752656Ab0KEPQI (ORCPT ); Fri, 5 Nov 2010 11:16:08 -0400 Received: by mail-bw0-f46.google.com with SMTP id 11so2759744bwz.19 for ; Fri, 05 Nov 2010 08:16:07 -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=LaHOhr0szmOoOYm5rtZQbZAwQYRn28ersrm4n5B5NWbYIm3lp09Evc/uvq8qE6VhiY G4FW2tyUTMVOAdirL8UqqNFXkITulhN8QeikvchGok/YaDg+E1aksv4yjZOGpCYW0gMG /QqzPO1l4bzU5OWXNBZNHaCZq2C+KY/xl3BFs= 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=eh8yPuT5RkBI2whBE8frVYIrrX9cJQGlCoGCg7PPHIc/HkYFa52G9M//ymvyCTITaC srxjf1B+tmfL0UgarPy4z6gshKs/HvPU03AW+MFMDDyGTM7pcN/jZmri5teQgSx1630o CVkXOBu3tbYlmEFkscP3/2miZSL+qy5eId9j0= Received: by 10.204.72.135 with SMTP id m7mr1977685bkj.89.1288970167682; Fri, 05 Nov 2010 08:16:07 -0700 (PDT) Received: from localhost.localdomain (196-98-odb-svnet.titannet.ro [77.81.196.98]) by mx.google.com with ESMTPS id g8sm1080402bkg.11.2010.11.05.08.16.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 05 Nov 2010 08:16:06 -0700 (PDT) From: Ionut Nicu To: Greg Kroah-Hartman , Omar Ramirez Luna Cc: Fernando Guzman Lugo , Felipe Contreras , linux-omap , Ionut Nicu Subject: [PATCH v2 2/3] staging: tidspbridge: mgr_enum_node_info cleanup Date: Fri, 5 Nov 2010 17:15:47 +0200 Message-Id: <1288970148-22191-3-git-send-email-ionut.nicu@mindbit.ro> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1288970148-22191-1-git-send-email-ionut.nicu@mindbit.ro> References: <1288970148-22191-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 15:16:10 +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; }