]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/gmc-mh-1x-2x/api.c
Don't check sr_channel_new() return value (always succeeds).
[libsigrok.git] / src / hardware / gmc-mh-1x-2x / api.c
index 02eb6d6e18e7bcb21778f9879336e71ea42bc00e..8e7d2c1b961f106440c8fae4a1a9706173f73721 100644 (file)
@@ -237,8 +237,7 @@ static GSList *scan_1x_2x_rs232(GSList *options)
                sdi->conn = serial;
                sdi->priv = devc;
                sdi->driver = &gmc_mh_1x_2x_rs232_driver_info;
-               if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
-                       return NULL;
+               ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
                sdi->channels = g_slist_append(sdi->channels, ch);
                drvc->instances = g_slist_append(drvc->instances, sdi);
                devices = g_slist_append(devices, sdi);
@@ -329,22 +328,17 @@ static GSList *scan_2x_bd232(GSList *options)
 
                if (devc->model != METRAHIT_NONE) {
                        sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(devc->model));
-
                        devc->elapsed_msec = g_timer_new();
-
                        sdi->model = g_strdup(gmc_model_str(devc->model));
                        sdi->version = g_strdup_printf("Firmware %d.%d", devc->fw_ver_maj, devc->fw_ver_min);
                        sdi->conn = serial;
                        sdi->priv = devc;
                        sdi->driver = &gmc_mh_2x_bd232_driver_info;
-                       if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
-                               goto exit_err;
+                       ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
                        sdi->channels = g_slist_append(sdi->channels, ch);
                        drvc->instances = g_slist_append(drvc->instances, sdi);
                        devices = g_slist_append(devices, sdi);
-
                        devc = g_malloc0(sizeof(struct dev_context));
-
                        sdi = g_malloc0(sizeof(struct sr_dev_inst));
                        sdi->status = SR_ST_INACTIVE;
                        sdi->vendor = g_strdup(VENDOR_GMC);