Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4107275pxj; Tue, 11 May 2021 20:42:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS3xFKH6zuVQFH52NT3lqhnBvgYADcLPkCo8HXU+Uv4JxRd1vbku5mRzFzaUkiWY1M3FB8 X-Received: by 2002:a17:907:948d:: with SMTP id dm13mr33133893ejc.180.1620790933818; Tue, 11 May 2021 20:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620790933; cv=none; d=google.com; s=arc-20160816; b=K40xATbkYRgdhqB3sYHpKhe/a58v0qljTnq46423zhaH+tRKzmCnqqoW9wu5lQ5YMW t1MI86AXA/Jx54re0RYX7nqsdqOlayV8gk+L+4Exoe5V2YwFQXaE+DSpXU8SNSDzEfZh 5AZqWGL6ucFgUZrejyB4IAoPhn0OyMr2X+fhOdx4gR+VwztjE3XhOu0piCYNCFrXc6wT nXaucDXMI7NXV1U57LxWmzt2Ib/87cBTMXbDOKtZAm0c3n/4rxk516YgRhTDsWeC/NBt /Ll6p9znRPBFjCrgdylXBGqfkynfo1I4v6r/lBgQhidGuxIXDE2IANZUpe60gWzxOEiG InDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=LRFTSEylZq1nAvQ+fdvg1F9aRq8oF3XXdUiZQJzVz7Y=; b=R9yv0ejBP4y7pyiCbGJqI8xafbHLXPtnL389RXd/xPFqLG9ZnZN0c76kvUAVvDHQSD wHYcfUr3WE/pnQqkk/1F4nbJW3MiLwD+Qpa+FHMVPHj5ROEne3haoMEIA2Hm+4XUsTXu O02IwgdgQXT+a4HDkUeIJd7ittmXkE70rGqyshp7EE9ab0hF0DvZ301mxiWdbPfv1JyU 9gOUCZDvd4dB8wTwygiKscWPDET8NoOgtc8Po9VxOMsCJRQTSPjM+nD6gmhmOEkWReiK 39o/+vLwECC04svY3xU8lNdZsktDhccdiKKU72qQyH3+9gumUeNeS+XoREAQDJseQMs6 QzVw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si642416edd.87.2021.05.11.20.41.49; Tue, 11 May 2021 20:42:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbhELDle (ORCPT + 99 others); Tue, 11 May 2021 23:41:34 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2564 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbhELDle (ORCPT ); Tue, 11 May 2021 23:41:34 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Fg0qF5NQzzwSQd; Wed, 12 May 2021 11:37:45 +0800 (CST) Received: from linux-lmwb.huawei.com (10.175.103.112) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Wed, 12 May 2021 11:40:15 +0800 From: Zou Wei To: , , CC: , , Zou Wei Subject: [PATCH -next] pwm: img: Fix PM reference leak in img_pwm_enable() Date: Wed, 12 May 2021 11:57:17 +0800 Message-ID: <1620791837-16138-1-git-send-email-zou_wei@huawei.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.103.112] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Reported-by: Hulk Robot Signed-off-by: Zou Wei --- drivers/pwm/pwm-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c index cc37054..11b16ec 100644 --- a/drivers/pwm/pwm-img.c +++ b/drivers/pwm/pwm-img.c @@ -156,7 +156,7 @@ static int img_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) struct img_pwm_chip *pwm_chip = to_img_pwm_chip(chip); int ret; - ret = pm_runtime_get_sync(chip->dev); + ret = pm_runtime_resume_and_get(chip->dev); if (ret < 0) return ret; -- 2.6.2