Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1115992pxf; Thu, 8 Apr 2021 23:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJCoeWkKfk3dOXRIV6HJdjP1+TIBfBP4ksQBIYsgsI0AiRx+Hg+PSePkdaQlPbsa+BuQmG X-Received: by 2002:a65:584b:: with SMTP id s11mr11501122pgr.129.1617950874704; Thu, 08 Apr 2021 23:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617950874; cv=none; d=google.com; s=arc-20160816; b=DSCcDGwX8s5NYSchGprsRHTqSu+8tb2xh9KE1FPSNvZbGpqBVgjzWF2Oi1JlamtyKu V35bVAzLDFeplJ5dnAUnYDNwNS7BOFzc4TYY2ZfW618JSapjiuRqe3CbU/Nk9BjRkVLq Lr6f9V7nDyfkOTJG3Wynlgs1iDH0itrJNYsjOHNImj/TnKw70S43LcdC8CsaRuz30Zht ozMngenYQBhBvWio4kUoXUa11VVaaen0nGbJNNaUiwe/r63V2djJkFPWPRJXoPMrrkDN zaBzFlcf24LMpqh3yowoNt9MErzMoID/sdhbqSZkU1NWYN5fhdYI/yKqXiEMv5jTwdVG Qm3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=et+RQPJ/NFYNKCkttVj/Dgq0GzijYoQDn826bX051uo=; b=zf1j0WRdSO607VeVF0LaZPMISWePL0jrx9ZfwtiwGD57+90Nlmf7daEiDx/2tAYC1n En3kJc4r7R5ZSCIs+h41nBhN7na3w0HpXvmAHSCjsEAOmQ0zxiPEJn38N5wNMzcO3YKf lOuALcbOKe1XDFxNvnV4XnUjJ2WL9fRPyL1sQ/JrLKC9YIZdnWv9HIJyB1BEMfb4bneZ 0ecOZf923GX8v5AQS7pBRARMUrR/mH16Ej1lS39daZOcsp8LnoVxCjdJHnLrnftoYBF+ PlHJqoGFJMTTDO3V9C9cpO1Jhv081V2pVPT6F4QCumfNzFKBAz5d2+L5PDW7ijLHXvHp 9Uww== 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 lt14si2402821pjb.146.2021.04.08.23.47.43; Thu, 08 Apr 2021 23:47:54 -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 S233438AbhDIGrN (ORCPT + 99 others); Fri, 9 Apr 2021 02:47:13 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16495 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233421AbhDIGrN (ORCPT ); Fri, 9 Apr 2021 02:47:13 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FGpWb08XQzPp1b; Fri, 9 Apr 2021 14:44:11 +0800 (CST) Received: from ubuntu1604.huawei.com (10.67.174.160) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 9 Apr 2021 14:46:53 +0800 From: Xiang Yang To: , Jernej Skrabec , "Mauro Carvalho Chehab" , Maxime Ripard , Chen-Yu Tsai , Philipp Zabel CC: , , , , , Hulk Robot Subject: [PATCH -next] media: sunxi: sun8i-rotate: fix PM reference leak in rotate_start_streaming() Date: Fri, 9 Apr 2021 14:46:58 +0800 Message-ID: <20210409064658.90493-1-xiangyang3@huawei.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.67.174.160] 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: Xiang Yang --- .../platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 3f81dd17755c..fbcca59a0517 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count) struct device *dev = ctx->dev->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "Failed to enable module\n");