synaptics: Use an autoptr to handle the FpiUsbTransfer sync transfers

When using fpi_usb_transfer_submit_sync we still need to unref the transfer
once done with it, so let's use an auto pointer so we free it also on
errors and early returns without having to handle this manually.
This commit is contained in:
Marco Trevisan (Treviño) 2019-11-28 20:34:20 +01:00 committed by Marco Trevisan
parent f9b2c7f9c3
commit ee606ae49e

View file

@ -950,7 +950,8 @@ dev_probe (FpDevice *device)
{
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (device);
GUsbDevice *usb_dev;
FpiUsbTransfer *transfer;
g_autoptr(FpiUsbTransfer) transfer = NULL;
FpiByteReader reader;
GError *error = NULL;
guint16 status;
@ -985,7 +986,7 @@ dev_probe (FpDevice *device)
if (!fpi_usb_transfer_submit_sync (transfer, 1000, &error))
goto err_close;
g_clear_pointer (&transfer, fpi_usb_transfer_unref);
transfer = fpi_usb_transfer_new (device);
fpi_usb_transfer_fill_bulk (transfer, USB_EP_REPLY, 40);
if (!fpi_usb_transfer_submit_sync (transfer, 1000, &error))