From: Gerhard Sittig Date: Sat, 14 Dec 2019 08:27:15 +0000 (+0100) Subject: uni-t-ut32x: drop redundant close and free at end of scan X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=00f3c94386a1fe58f31f5bf4e82346ed31b84ff4;p=libsigrok.git uni-t-ut32x: drop redundant close and free at end of scan The UT32x driver requires a user spec for the connection. The device cannot get identified, that's why successful open/close for the port will suffice. Lack of an input spec as well as failure in the early scan phase will terminate the scan routine early. When we reach the end of the scan which creates the device instance and registers it with the list of found devices, the port already is closed and the list of devices will never be empty. Remove the redundant close call and the dead branch which frees the serial port. --- diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index 21e5be7d..ce81b3cc 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -114,10 +114,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } devices = g_slist_append(devices, sdi); - serial_close(serial); - if (!devices) - sr_serial_dev_inst_free(serial); - return std_scan_complete(di, devices); }