trivial: Do not allow calling klass->close multiple times on the same device

This commit is contained in:
Richard Hughes 2017-11-29 21:10:22 +00:00
parent 4fbba6f7c0
commit 18fcbdac53

View File

@ -239,6 +239,10 @@ fu_usb_device_close (FuUsbDevice *device, GError **error)
g_return_val_if_fail (FU_IS_USB_DEVICE (device), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* already open */
if (priv->usb_device_locker == NULL)
return TRUE;
/* subclassed */
if (klass->close != NULL) {
if (!klass->close (device, error))