+ free(tmp_list);
+
+ return 0;
+}
+
+/*
+ * Load data kernel module(s).
+ */
+int modprobe_lttng_data(void)
+{
+ int ret, i;
+ char *list;
+
+ /*
+ * Base probes: either from command line option, environment
+ * variable or default list.
+ */
+ if (kmod_probes_list) {
+ list = kmod_probes_list;
+ } else {
+ list = utils_get_kmod_probes_list();
+ }
+
+ if (list) {
+ /* User-specified probes. */
+ ret = append_list_to_probes(list);
+
+ if (ret) {
+ return ret;
+ }
+ } else {
+ /* Default probes. */
+ int def_len = ARRAY_SIZE(kern_modules_probes_default);
+ probes = zmalloc(sizeof(*probes) * def_len);
+
+ if (!probes) {
+ PERROR("malloc probe list");
+ return -ENOMEM;
+ }
+
+ nr_probes = probes_capacity = def_len;
+
+ for (i = 0; i < def_len; ++i) {
+ char* name = strdup(kern_modules_probes_default[i].name);
+
+ if (!name) {
+ PERROR("strdup probe item");
+ return -ENOMEM;
+ }
+
+ probes[i].name = name;
+ }
+ }
+
+ /*
+ * Extra modules? Append them to current probes list.
+ */
+ if (kmod_extra_probes_list) {
+ list = kmod_extra_probes_list;
+ } else {
+ list = utils_get_extra_kmod_probes_list();
+ }
+
+ if (list) {
+ ret = append_list_to_probes(list);
+ if (ret) {
+ return ret;
+ }
+ }
+
+ /*
+ * Load probes modules now.
+ */