| 26 | } |
| 27 | |
| 28 | struct rte_eth_dev * |
| 29 | eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, |
| 30 | const void *data) |
| 31 | { |
| 32 | struct rte_eth_dev *edev; |
| 33 | ptrdiff_t idx; |
| 34 | |
| 35 | /* Avoid Undefined Behaviour */ |
| 36 | if (start != NULL && |
| 37 | (start < &rte_eth_devices[0] || |
| 38 | start > &rte_eth_devices[RTE_MAX_ETHPORTS])) |
| 39 | return NULL; |
| 40 | if (start != NULL) |
| 41 | idx = eth_dev_to_id(start) + 1; |
| 42 | else |
| 43 | idx = 0; |
| 44 | for (; idx < RTE_MAX_ETHPORTS; idx++) { |
| 45 | edev = &rte_eth_devices[idx]; |
| 46 | if (cmp(edev, data) == 0) |
| 47 | return edev; |
| 48 | } |
| 49 | return NULL; |
| 50 | } |
| 51 | |
| 52 | /* Put new value into list. */ |
| 53 | static int |
no test coverage detected