Removed comment about STM32F4 limitations
[fw/stlink] / src / stlink-sg.c
index ac6a6cf81891de4b42998208cafd8abd9d27ec72..b8220de133bf2c26a5f6b92338c87b288bb8e09c 100644 (file)
 #include <sys/stat.h>
 #include <sys/mman.h>
 
+#include "stlink-common.h"
+
+#if CONFIG_USE_LIBSG
 // sgutils2 (apt-get install libsgutils2-dev)
 #include <scsi/sg_lib.h>
 #include <scsi/sg_pt.h>
-
-#include "stlink-common.h"
 #include "stlink-sg.h"
+#endif
 
 
 // Suspends execution of the calling process for
@@ -119,9 +121,7 @@ void _stlink_sg_close(stlink_t *sl) {
     if (sl) {
         struct stlink_libsg *slsg = sl->backend_data;
         scsi_pt_close_device(slsg->sg_fd);
-        // CAUTION!? s this right?
         free(slsg);
-        free(sl);
     }
 }