]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/asix-sigma/asix-sigma.c
asix-sigma: Use the more portable g_usleep().
[libsigrok.git] / src / hardware / asix-sigma / asix-sigma.c
index 53e35816374614babce2568978c7e844750b3303..0e6180cbe1b1e0c74c0fb50601b87ea695eb8793 100644 (file)
@@ -341,10 +341,7 @@ static GSList *scan(GSList *options)
 
        devices = NULL;
 
-       if (!(devc = g_try_malloc(sizeof(struct dev_context)))) {
-               sr_err("%s: devc malloc failed", __func__);
-               return NULL;
-       }
+       devc = g_malloc0(sizeof(struct dev_context));
 
        ftdi_init(&devc->ftdic);
 
@@ -389,8 +386,6 @@ static GSList *scan(GSList *options)
        for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
                ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
                                    channel_names[i]);
-               if (!ch)
-                       return NULL;
                sdi->channels = g_slist_append(sdi->channels, ch);
        }
 
@@ -451,7 +446,7 @@ static int sigma_fpga_init_bitbang(struct dev_context *devc)
                if (data & (1 << 5))
                        return 0;
                /* The D6 was not asserted yet, wait a bit. */
-               usleep(10000);
+               g_usleep(10000);
        }
 
        return SR_ERR_TIMEOUT;