USB: u_data_ipa: Fix pm_runtime usage count in case of error

If disconnect happens before connect_work start executing, then
there is a chance that connect_work returns with port_usb NULL.
Due to this, port->is_connected will be NULL and disconnect_work
returns with this check, but not decremented pm_usage count, which
is incremented before scheduling connect_work in ipa_data_connect.
Hence fix this by decrementing pm_usage count in connect_work if
port_usb is NULL.

Change-Id: Ic60f2addcf07375429e0858d3c7a376a35132750
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
This commit is contained in:
Vijayavardhan Vennapusa 2017-02-02 16:51:27 +05:30
parent 110e102fe3
commit 94cd6c197a

View file

@ -402,6 +402,7 @@ static void ipa_data_connect_work(struct work_struct *w)
if (!port->port_usb) {
spin_unlock_irqrestore(&port->port_lock, flags);
usb_gadget_autopm_put_async(port->gadget);
pr_err("%s(): port_usb is NULL.\n", __func__);
return;
}