GSList *l;
int ret;
- drvc = driver->priv;
+ if (!(drvc = driver->priv))
+ /* Driver was never initialized, nothing to do. */
+ return SR_OK;
+
ret = SR_OK;
for (l = drvc->instances; l; l = l->next) {
/* Log errors, but continue cleaning up the rest. */
if (sdi->conn) {
if (sdi->inst_type == SR_INST_USB)
+#if HAVE_LIBUSB_1_0
sr_usb_dev_inst_free(sdi->conn);
+#else
+ ;
+#endif
else if (sdi->inst_type == SR_INST_SERIAL)
sr_serial_dev_inst_free(sdi->conn);
}