]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/gmc-mh-1x-2x/api.c
Use g_malloc0() consistently, simplify error handling.
[libsigrok.git] / src / hardware / gmc-mh-1x-2x / api.c
index 8e7d2c1b961f106440c8fae4a1a9706173f73721..91267d98c3e2df3580ceb6ea9b30f0901df84e68 100644 (file)
@@ -195,8 +195,7 @@ static GSList *scan_1x_2x_rs232(GSList *options)
        if (!serialcomm)
                serialcomm = SERIALCOMM_2X_RS232;
 
-       if (!(serial = sr_serial_dev_inst_new(conn, serialcomm)))
-               return NULL;
+       serial = sr_serial_dev_inst_new(conn, serialcomm);
 
        if (serial_open(serial, SERIAL_RDWR) != SR_OK) {
                sr_serial_dev_inst_free(serial);
@@ -288,8 +287,7 @@ static GSList *scan_2x_bd232(GSList *options)
        if (!serialcomm)
                serialcomm = SERIALCOMM_2X;
 
-       if (!(serial = sr_serial_dev_inst_new(conn, serialcomm)))
-               return NULL;
+       serial = sr_serial_dev_inst_new(conn, serialcomm);
 
        if (serial_open(serial, SERIAL_RDWR) != SR_OK)
                goto exit_err;