]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: cdns3: Fix runtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 12 Apr 2021 05:49:07 +0000 (13:49 +0800)
committerPeter Chen <peter.chen@kernel.org>
Mon, 19 Apr 2021 03:53:20 +0000 (11:53 +0800)
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>
drivers/usb/cdns3/cdns3-gadget.c

index 582bfeceedb47f523342359fc28985129f8ff6ff..a49fc68ec2efc64917863879a48440097e621068 100644 (file)
@@ -3255,8 +3255,10 @@ static int __cdns3_gadget_init(struct cdns *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