Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1516183pxb; Sun, 11 Apr 2021 23:01:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVQV3k4u3oeyETbIeaWnKODUHgWXRahUs0U+ftveCIfejI72EJ1xE4v3mqP+AS1DloYM/U X-Received: by 2002:a17:907:3f19:: with SMTP id hq25mr11421305ejc.271.1618207305454; Sun, 11 Apr 2021 23:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618207305; cv=none; d=google.com; s=arc-20160816; b=XpttbLFQAMBbF+cbOEFSpjBIPBBFlGKBYsjClIZ27Y2teLUWbgNpkuCKWjehw2GKEz DzdkTlwIKuS4Asm4Qmtsex/wTnoorV/u9b6hq1UqCWlceGfKkNJUBRdNACPkYRPxh0Yj gaTo2izR/+gyp7k+8Cb7DDhDxA+0L/FHpKVeAgESJWpUfnwFK2faErIiu64VrHK4twTV ICd6hHSOXRYRPj5g6bBpVYIkNaoHfBpCZMuJeVTX6JomRzNa7SicL+fQfNYgUHUWVzgN 6BpBL6N4yev7kdO83SD5h+lZ+EpvGxUA509xIVYvSL3MACclSxiwQIgTE1ytc2AQ4qKK 11bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=/fubOJYT/BuDJZirxXu7wBO1ClTE5IgbSGOmeNvyGGU=; b=rvCrXIoLiOZQ6XFayNo/723AjzugkWHdsOOFFv0+JTjwxRS8jc6EldcuwFIbqecF4N CKRqEVSNC/D8uja6qS6fy//aXf+P0sDBPpJoP8/4XwaSJWZbKDzRiNMm7WUDNDxLvcc7 jM4QZNukLQvhenRz3Mm1Lvg8SeflRjJ0zFdDBaoJxIxJlcTjqhFNZB5PgRp+E91gjw55 /B4tbKMl+emcMdWZD8n0Hs4LQzfSfKlvx/8Ech0SJP5pQ3xPt5525fY2J0KXSll5ugdb 78/95pERT/88Eb+syDwYeh0kUhmTPk9l36+nzJ764W9SZ4obG3GsI5jlvPEzyCIdKh5E HGPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si6890954edm.52.2021.04.11.23.00.53; Sun, 11 Apr 2021 23:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230133AbhDLFto (ORCPT + 99 others); Mon, 12 Apr 2021 01:49:44 -0400 Received: from mail.zju.edu.cn ([61.164.42.155]:38050 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229482AbhDLFtn (ORCPT ); Mon, 12 Apr 2021 01:49:43 -0400 Received: from localhost.localdomain (unknown [10.192.139.175]) by mail-app4 (Coremail) with SMTP id cS_KCgDHiAxU33NgrAm2AA--.58807S4; Mon, 12 Apr 2021 13:49:17 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Peter Chen , Pawel Laszczak , Roger Quadros , Aswath Govindraju , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] usb: cdns3: Fix runtime PM imbalance on error Date: Mon, 12 Apr 2021 13:49:07 +0800 Message-Id: <20210412054908.7975-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cS_KCgDHiAxU33NgrAm2AA--.58807S4 X-Coremail-Antispam: 1UD129KBjvdXoW7GrWfKF4rur4Dt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: linux-kernel@vger.kernel.org When cdns3_gadget_start() fails, a pairing PM usage counter decrement is needed to keep the counter balanced. Signed-off-by: Dinghao Liu --- Changelog: v2: - Use pm_runtime_put_sync() to decrease refcount. --- drivers/usb/cdns3/cdns3-gadget.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c index 582bfeceedb4..a49fc68ec2ef 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -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 -- 2.17.1