Skip to content

Commit

Permalink
usb: misc: ljca: move usb_autopm_put_interface() after wait for response
Browse files Browse the repository at this point in the history
Do not mark interface as ready to suspend when we are still waiting
for response messages from the device.

Fixes: acd6199 ("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
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://lore.kernel.org/r/20241112075514.680712-1-stanislaw.gruszka@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Stanislaw Gruszka authored and Greg Kroah-Hartman committed Nov 12, 2024
1 parent 1d062ff commit 5c5d8eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/usb/misc/usb-ljca.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,26 +332,26 @@ 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) {
ret = wait_for_completion_timeout(&adap->cmd_completion,
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;
Expand Down

0 comments on commit 5c5d8eb

Please sign in to comment.