Message ID | 20241106123438.337117-1-stanislaw.gruszka@linux.intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2,1/3] usb: misc: ljca: move usb_autopm_put_interface() after wait for response | expand |
On Wed, Nov 06, 2024 at 01:34:36PM +0100, Stanislaw Gruszka wrote: > Do not mark interface as ready to suspend when we are still waiting > for response messages from the device. > > Fixes: acd6199f195d ("usb: Add support for Intel LJCA device") > Cc: stable@vger.kernel.org > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > Tested-by: Hans de Goede <hdegoede@redhat.com> # ThinkPad X1 Yoga Gen 8, ov2740 > Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
diff --git a/drivers/usb/misc/usb-ljca.c b/drivers/usb/misc/usb-ljca.c index 01ceafc4ab78..8056c65e4548 100644 --- a/drivers/usb/misc/usb-ljca.c +++ b/drivers/usb/misc/usb-ljca.c @@ -332,14 +332,11 @@ static int ljca_send(struct ljca_adapter *adap, u8 type, u8 cmd, ret = usb_bulk_msg(adap->usb_dev, adap->tx_pipe, header, msg_len, &transferred, LJCA_WRITE_TIMEOUT_MS); - - usb_autopm_put_interface(adap->intf); - if (ret < 0) - goto out; + goto out_put; if (transferred != msg_len) { ret = -EIO; - goto out; + goto out_put; } if (ack) { @@ -347,11 +344,14 @@ static int ljca_send(struct ljca_adapter *adap, u8 type, u8 cmd, timeout); if (!ret) { ret = -ETIMEDOUT; - goto out; + goto out_put; } } ret = adap->actual_length; +out_put: + usb_autopm_put_interface(adap->intf); + out: spin_lock_irqsave(&adap->lock, flags); adap->ex_buf = NULL;