Remove duplicate stop command in hackrf_close().

This commit is contained in:
Martin Ling
2022-03-18 10:57:38 +00:00
parent b109a31fd3
commit f046ed24a3

View File

@ -1947,22 +1947,20 @@ int ADDCALL hackrf_stop_tx(hackrf_device* device)
int ADDCALL hackrf_close(hackrf_device* device) int ADDCALL hackrf_close(hackrf_device* device)
{ {
int result1, result2, result3; int result1, result2;
result1 = HACKRF_SUCCESS; result1 = HACKRF_SUCCESS;
result2 = HACKRF_SUCCESS; result2 = HACKRF_SUCCESS;
result3 = HACKRF_SUCCESS;
if( device != NULL ) if( device != NULL )
{ {
result1 = hackrf_stop_cmd(device); result1 = hackrf_stop_cmd(device);
result2 = hackrf_stop_cmd(device);
/* /*
* Finally kill the transfer thread, which will * Finally kill the transfer thread, which will
* also cancel any pending transmit/receive transfers. * also cancel any pending transmit/receive transfers.
*/ */
result3 = kill_transfer_thread(device); result2 = kill_transfer_thread(device);
if( device->usb_device != NULL ) if( device->usb_device != NULL )
{ {
libusb_release_interface(device->usb_device, 0); libusb_release_interface(device->usb_device, 0);
@ -1980,10 +1978,6 @@ int ADDCALL hackrf_close(hackrf_device* device)
} }
open_devices--; open_devices--;
if (result3 != HACKRF_SUCCESS)
{
return result3;
}
if (result2 != HACKRF_SUCCESS) if (result2 != HACKRF_SUCCESS)
{ {
return result2; return result2;