]> sigrok.org Git - libsigrok.git/blobdiff - src/serial_hid.c
serial: Shorten a few code snippets.
[libsigrok.git] / src / serial_hid.c
index d2776fc7d79cf2f789d3d62939c3b7892e764132..ee073d1dbbb509d60d7d62cdc69975c9d90e3f4b 100644 (file)
@@ -635,9 +635,8 @@ SR_PRIV const char *ser_hid_chip_find_name_vid_pid(uint16_t vid, uint16_t pid)
                if (!vid_pids)
                        continue;
                while (vid_pids->vid) {
-                       if (vid_pids->vid == vid && vid_pids->pid == pid) {
+                       if (vid_pids->vid == vid && vid_pids->pid == pid)
                                return desc->chipname;
-                       }
                        vid_pids++;
                }
        }
@@ -1298,10 +1297,8 @@ static int ser_hid_read(struct sr_serial_dev_inst *serial,
         * Immediately satisfy the caller's request from the RX buffer
         * if the requested amount of data is available already.
         */
-       if (sr_ser_has_queued_data(serial) >= count) {
-               rc = sr_ser_unqueue_rx_data(serial, buf, count);
-               return rc;
-       }
+       if (sr_ser_has_queued_data(serial) >= count)
+               return sr_ser_unqueue_rx_data(serial, buf, count);
 
        /*
         * When a timeout was specified, then determine the deadline
@@ -1387,9 +1384,8 @@ static int ser_hid_read(struct sr_serial_dev_inst *serial,
        if (got > count)
                got = count;
        sr_dbg("DBG: %s() passing %d bytes.", __func__, got);
-       rc = sr_ser_unqueue_rx_data(serial, buf, count);
 
-       return rc;
+       return sr_ser_unqueue_rx_data(serial, buf, count);
 }
 
 static struct ser_lib_functions serlib_hid = {