Don't call hackrf_exit if hackrf_init failed;

don't call hackrf_close if hackrf_open failed.
This commit is contained in:
Oliver Jowett 2020-08-03 14:45:35 +08:00
parent 699576f3de
commit 8b6239fab7
1 changed files with 0 additions and 3 deletions

View File

@ -131,15 +131,12 @@ bool hackRFOpen()
status = hackrf_init();
if (status != 0) {
fprintf(stderr, "HackRF: hackrf_init failed with code %d\n", status);
hackrf_close(HackRF.device);
hackrf_exit();
return false;
}
status = hackrf_open(&HackRF.device);
if (status != 0) {
fprintf(stderr, "HackRF: hackrf_open failed with code %d\n", status);
hackrf_close(HackRF.device);
hackrf_exit();
return false;
}