Changes in uspace/lib/c/generic/device/hw_res.c [be942bc:96b02eb9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/device/hw_res.c
rbe942bc r96b02eb9 38 38 #include <malloc.h> 39 39 40 intget_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)40 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources) 41 41 { 42 42 sysarg_t count = 0; 43 43 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), GET_RESOURCE_LIST, &count); 44 44 hw_resources->count = count; 45 if (rc != EOK) 46 return rc; 45 if (EOK != rc) { 46 return false; 47 } 47 48 48 49 size_t size = count * sizeof(hw_resource_t); 49 50 hw_resources->resources = (hw_resource_t *)malloc(size); 50 if (!hw_resources->resources) 51 return ENOMEM; 51 if (NULL == hw_resources->resources) { 52 return false; 53 } 52 54 53 55 rc = async_data_read_start(dev_phone, hw_resources->resources, size); 54 if ( rc != EOK) {56 if (EOK != rc) { 55 57 free(hw_resources->resources); 56 58 hw_resources->resources = NULL; 57 return rc;59 return false; 58 60 } 59 61 60 return EOK;62 return true; 61 63 } 62 64
Note:
See TracChangeset
for help on using the changeset viewer.