- /*Counting the number of devices in a group and getting the mcp ID*/
- ndev_count = 0;
- mcp_obj = NULL;
- while ((dir = readdir(d)) != NULL) {
- if (dir->d_type == DT_LNK) {
- ndev_count++;
- if (!strncmp("dpmcp", dir->d_name, 5)) {
- if (mcp_obj)
- free(mcp_obj);
- mcp_obj = malloc(sizeof(dir->d_name));
- if (!mcp_obj) {
- FSLMC_VFIO_LOG(ERR,
- "mcp obj:alloc failed");
- closedir(d);
- return -ENOMEM;
- }
- strcpy(mcp_obj, dir->d_name);
- temp_obj = strtok(dir->d_name, ".");
- temp_obj = strtok(NULL, ".");
- sscanf(temp_obj, "%d", &mcp_id);
- }
- }
- }
- closedir(d);
- d = NULL;
- if (!mcp_obj) {
- FSLMC_VFIO_LOG(ERR, "DPAA2 MCP Object not Found");
- return -ENODEV;
- }
- RTE_LOG(INFO, EAL, "fslmc: DPRC contains = %d devices\n", ndev_count);
-
- /* Allocate the memory depends upon number of objects in a group*/
- group->vfio_device = (struct fslmc_vfio_device *)malloc(ndev_count *
- sizeof(struct fslmc_vfio_device));
- if (!(group->vfio_device)) {
- FSLMC_VFIO_LOG(ERR, "vfio device: Unable to allocate memory\n");
- free(mcp_obj);
+ rte_mcp_ptr_list = malloc(sizeof(void *) * 1);
+ if (!rte_mcp_ptr_list) {
+ FSLMC_VFIO_LOG(ERR, "Out of memory");