Sigma: Check state in hw_closedev
If the device is closed without previously running hw_openedev the driver crashes (happens in cleanup). This patch checks if the device has been opened.
This commit is contained in:
parent
02440dd88c
commit
9be9893eed
|
@ -644,9 +644,15 @@ static int configure_probes(GSList *probes)
|
|||
|
||||
static void hw_closedev(int device_index)
|
||||
{
|
||||
device_index = device_index;
|
||||
struct sigrok_device_instance *sdi;
|
||||
|
||||
ftdi_usb_close(&ftdic);
|
||||
if ((sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
{
|
||||
if (sdi->status == ST_ACTIVE)
|
||||
ftdi_usb_close(&ftdic);
|
||||
|
||||
sdi->status = ST_INACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
static void hw_cleanup(void)
|
||||
|
|
Loading…
Reference in New Issue