dediprog: Revise id matching

Avoid printing a redundant error message, as we already print one inside
dediprog_read_id().  Also break early when a match is found, so we don't
have to repeat the clean-up code.

Change-Id: I2f85432a83f1a9d1b6efe0fc9c47a36d9c4934a8
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/104
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/dediprog.c b/dediprog.c
index db0c130..247f9de 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -1331,19 +1331,13 @@
 			 * the device is skipped and the next device is tried.
 			 */
 			found_id = dediprog_read_id(dp_data);
-			if (found_id < 0) {
-				msg_perr("Could not read id.\n");
-				libusb_release_interface(dp_data->handle, 0);
-				libusb_close(dp_data->handle);
-				continue;
-			}
-			msg_pinfo("Found dediprog id SF%06d.\n", found_id);
-			if (found_id != id) {
-				libusb_release_interface(dp_data->handle, 0);
-				libusb_close(dp_data->handle);
-				continue;
-			}
-			break;
+			if (found_id >= 0)
+				msg_pinfo("Found dediprog id SF%06d.\n", found_id);
+			if (found_id == id)
+				break;
+
+			libusb_release_interface(dp_data->handle, 0);
+			libusb_close(dp_data->handle);
 		}
 	} else {
 		if (dediprog_open(usedevice, dp_data)) {