nolo: Do not call NOLO_ERROR_LOG when not needed

This commit is contained in:
Pali Rohár committed 2014-11-18 20:15:14 +01:00
1 parent 142ef93ddc
commit 8c788bad62
1 file changed
+8 -4
+8 -4
View File
@@ -84,12 +84,14 @@ static void nolo_error_log(struct usb_device_info * dev, int only_clear) {
char buf[2048];
size_t i, count;
int ret;
for ( count = 0; count < 20; ++count ) {
memset(buf, 0, sizeof(buf));
if ( usb_control_msg(dev->udev, NOLO_QUERY, NOLO_ERROR_LOG, 0, 0, buf, sizeof(buf), 2000) <= 0 )
ret = usb_control_msg(dev->udev, NOLO_QUERY, NOLO_ERROR_LOG, 0, 0, buf, sizeof(buf), 2000);
if ( ret < 0 )
break;
if ( ! only_clear ) {
@@ -103,6 +105,9 @@ static void nolo_error_log(struct usb_device_info * dev, int only_clear) {
}
if ( (size_t)ret < sizeof(buf) )
break;
}
}
@@ -180,11 +185,10 @@ static int nolo_get_version_string(struct usb_device_info * dev, const char * st
return -1;
ret = nolo_get_string(dev, buf, out, size);
if ( ret < 0 ) {
nolo_error_log(dev, 1);
if ( ret < 0 )
return ret;
}
if ( ! out[0] )
return -1;