]> sigrok.org Git - libsigrok.git/blobdiff - hardware/colead-slm/api.c
sr_driver_scan(): Improve checks.
[libsigrok.git] / hardware / colead-slm / api.c
index 048fdd918e84587d8be369e4a27fcc4f0c4c7bc3..39e557a676ee2106fd9d232e82e6c154f0edcab7 100644 (file)
@@ -78,7 +78,7 @@ static int hw_init(struct sr_context *sr_ctx)
 
        if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
                sr_err("Driver context malloc failed.");
-               return SR_ERR;
+               return SR_ERR_MALLOC;
        }
 
        drvc->sr_ctx = sr_ctx;
@@ -97,10 +97,11 @@ static GSList *hw_scan(GSList *options)
        GSList *devices, *l;
        const char *conn, *serialcomm;
 
-       devices = NULL;
        drvc = di->priv;
        drvc->instances = NULL;
 
+       devices = NULL;
+
        conn = serialcomm = NULL;
        for (l = options; l; l = l->next) {
                src = l->data;
@@ -123,7 +124,7 @@ static GSList *hw_scan(GSList *options)
                return NULL;
 
        if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
-               sr_dbg("failed to malloc devc");
+               sr_dbg("Device context malloc failed.");
                return NULL;
        }