X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=std.c;h=cfe031d993b5e7071e4066bd35c6c091091ff0a1;hb=refs%2Ftags%2Flibsigrok-0.2.0;hp=8add0d3dc622c2045cfa5c870efb4ab39183dde7;hpb=c2523f221364c0df51b8093693a246a713633912;p=libsigrok.git diff --git a/std.c b/std.c index 8add0d3d..cfe031d9 100644 --- a/std.c +++ b/std.c @@ -184,7 +184,10 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, 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. */ @@ -201,7 +204,11 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, 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); }