* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/types.h>
-#include <sys/queue.h>
#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
-#include <inttypes.h>
-#include <netinet/in.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/queue.h>
#include <rte_byteorder.h>
#include <rte_log.h>
rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str)
{
int ret;
- struct rte_devargs devargs = {.args = NULL};
+ struct rte_devargs devargs;
const char *bus_param_key;
char *bus_str = NULL;
char *cls_str = NULL;
int str_size;
memset(iter, 0, sizeof(*iter));
+ memset(&devargs, 0, sizeof(devargs));
/*
* The devargs string may use various syntaxes:
goto error;
}
iter->cls_str = cls_str;
- free(devargs.args); /* allocated by rte_devargs_parse() */
- devargs.args = NULL;
iter->bus = devargs.bus;
if (iter->bus->dev_iterate == NULL) {
end:
iter->cls = rte_class_find_by_name("eth");
+ rte_devargs_reset(&devargs);
return 0;
error:
if (ret == -ENOTSUP)
RTE_ETHDEV_LOG(ERR, "Bus %s does not support iterating.\n",
iter->bus->name);
- free(devargs.args);
+ rte_devargs_reset(&devargs);
free(bus_str);
free(cls_str);
return ret;