return SR_OK;
}
-static void hw_cleanup(void)
+static int hw_cleanup(void)
{
GSList *l;
struct sr_device_instance *sdi;
+ int ret = SR_OK;
/* Properly close all devices. */
for (l = device_instances; l; l = l->next) {
- sdi = l->data;
- if (sdi->priv != NULL)
- g_free(sdi->priv);
+ if (!(sdi = l->data)) {
+ /* Log error, but continue cleaning up the rest. */
+ sr_err("asix: %s: sdi was NULL, continuing", __func__);
+ ret = SR_ERR_BUG;
+ continue;
+ }
+ g_free(sdi->priv);
sr_device_instance_free(sdi);
}
g_slist_free(device_instances);
device_instances = NULL;
+
+ return ret;
}
static void *hw_get_device_info(int device_index, int device_info_id)