Skip to content

Commit

Permalink
usb: cdns3: Fix runtime PM imbalance on error
Browse files Browse the repository at this point in the history
[ Upstream commit 07adc02 ]

When cdns3_gadget_start() fails, a pairing PM usage counter
decrement is needed to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20210412054908.7975-1-dinghao.liu@zju.edu.cn
Signed-off-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dinghaoliu authored and gregkh committed Jun 16, 2021
1 parent 1e5cab5 commit 2f523cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/cdns3/gadget.c
Expand Up @@ -3255,8 +3255,10 @@ static int __cdns3_gadget_init(struct cdns3 *cdns)
pm_runtime_get_sync(cdns->dev);

ret = cdns3_gadget_start(cdns);
if (ret)
if (ret) {
pm_runtime_put_sync(cdns->dev);
return ret;
}

/*
* Because interrupt line can be shared with other components in
Expand Down

0 comments on commit 2f523cd

Please sign in to comment.