From patchwork Fri Oct 22 12:59:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ionut Nicu X-Patchwork-Id: 273971 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 o9MCxro7014283 for ; Fri, 22 Oct 2010 12:59:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756326Ab0JVM7w (ORCPT ); Fri, 22 Oct 2010 08:59:52 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:33200 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562Ab0JVM7w (ORCPT ); Fri, 22 Oct 2010 08:59:52 -0400 Received: by mail-bw0-f46.google.com with SMTP id 11so490266bwz.19 for ; Fri, 22 Oct 2010 05:59:51 -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; bh=Vh6tOibYvrWfDhjKhInhMauU5mMBuAXA39PQts/CMhw=; b=XeMNVsiT/z1/0mYv3bDG3TJOB5ITRMEOiHSjIM/ukpT96PBAPj7FD7ZnNJLKgaYZsT O32Uzy8movELv+uECBkbTRdFc3AiPP9Hda7e5AlzdzZWgWX57bmAgc3IjLlUz74uhLgt QHQA0GsaLm+HNFY33JCjy3ZZj4K3yhxdDhGhE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=lPydCKG0MKKIb/MS3NC1rIkJ1g3E5CVjJ3X2OaGriq8M5pvnuVyi/ahN7Oo9drdx7D nzm8MoIDGVAi5miNRp+v3o5N2LZXQm39Sc6AHODfUUi1vK2FAlCxm9df8+lqxjR22cZS mn/f+jH5ekppvdctnW3qCKE9JI3mtrTb/hpQI= Received: by 10.204.84.76 with SMTP id i12mr2137575bkl.72.1287752391393; Fri, 22 Oct 2010 05:59:51 -0700 (PDT) Received: from localhost.localdomain ([193.39.73.67]) by mx.google.com with ESMTPS id u4sm2124830bkz.5.2010.10.22.05.59.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 22 Oct 2010 05:59:50 -0700 (PDT) From: Ionut Nicu To: Greg Kroah-Hartman , Omar Ramirez Luna Cc: Fernando Guzman Lugo , Felipe Contreras , linux-omap , Ionut Nicu Subject: [PATCH] staging: tidspbridge: make the MGR_ENUMNODE_INFO ioctl work Date: Fri, 22 Oct 2010 15:59:46 +0300 Message-Id: <1287752386-5974-1-git-send-email-ionut.nicu@mindbit.ro> X-Mailer: git-send-email 1.7.2.3 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, 22 Oct 2010 12:59:53 +0000 (UTC) diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c index 0ea89a1..b7b7e5b 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,48 +148,31 @@ 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; - - } - } - if (!status) { - if (node_id > (node_index - 1)) { - status = -EINVAL; - } else { + 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, - (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; - } + &node_uuid, DSP_DCDNODETYPE, &gen_obj); + if (status) + break; + /* Get the Obj def */ + *pndb_props = gen_obj.obj_data.node_obj.ndb_props; } } -func_cont: - DBC_ENSURE((!status && *pu_num_nodes > 0) || - (status && *pu_num_nodes == 0)); - - return status; + return status == ENODATA ? 0 : status; } /*