Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1979711pxy; Sat, 24 Apr 2021 01:12:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMQhiDRGl4fzm2ZbP5JuEQf809ajEkjSW5cprdUHHuZptUrYpsebEsGn2VX7J6FGBPlqrA X-Received: by 2002:a05:6402:3587:: with SMTP id y7mr9374292edc.54.1619251957294; Sat, 24 Apr 2021 01:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619251957; cv=none; d=google.com; s=arc-20160816; b=x37QPCWE8P+CFFx/jBa0al0q5V46uJAI5B4JrMTX6JPJzfwGtwnBrV4TJEt/XeJf8b SqeXaCHVv/KjRf+7lcxyi0L7bXKFDPSI95c/Eo1KLNH1wHLIniK9V2TkO56viiMcC2Xr RwvvR9iubtAesPFtGDymq6u+zj8r2t1YmMcG/kWFH/G1y4T570gmAhQHAAy7Z6CxEQ3m kyuS/IWyTMTSexrS8+/wrNc3c/efw6Wz0e9fQqcBceZhx8DCtGoZkyt1WWEK+jDNqABP I+aGyQYiAvbL3JCGdWZ1MgMqTG0v9CkJS5oXGAg16i7iIHDDla5LIcFQxaEXxkDD+zNv kfHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=rFbigJ0WCTQWWXN6F5CPrTuTHqbPGu/rWiHPahxDyNs=; b=yIsZe1TrWvcCi3gUrMUc4CUTxG/maMEVEgCxbkqyNPA1opoLoTzx6u3x4Wa+jLJf6a d4kS/A+FrXZGcTo/GEx6kbFVaNJpfQ+19AnBwUVKmq7LpfT59T1+a81IIXs8MhZ8mEZk kkXl/rwDX+GhSCExxJzKlHkZFSnlasLiFDCrVE+5cbfkKgNm7vNUQj8J7BR+1c4DMTuO W2tLoLrSKOt4VkcYYOCo7pLXzDsXmpDvpkQ3WFA2Th6xrwDgg5jrWYubGkTddoE+g2hd uZhVYv1FbaT2Jo6zH+YQfHdfo5CwGsp6C3Xk9rusRirPS0ngeTU0iHaAEwoxpa4SKnlX VBNw== 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 m18si8105152edd.73.2021.04.24.01.12.14; Sat, 24 Apr 2021 01:12:37 -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 S233128AbhDXIL2 (ORCPT + 99 others); Sat, 24 Apr 2021 04:11:28 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:55305 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233135AbhDXILZ (ORCPT ); Sat, 24 Apr 2021 04:11:25 -0400 X-Originating-IP: 93.61.96.190 Received: from uno.localdomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 9E13040004; Sat, 24 Apr 2021 08:10:39 +0000 (UTC) Date: Sat, 24 Apr 2021 10:11:21 +0200 From: Jacopo Mondi To: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: Re: [PATCH 06/78] media: renesas-ceu: fix pm_runtime_get_sync() usage count Message-ID: <20210424081121.smppo4ly5p3fxto2@uno.localdomain> References: <29ba3fafde4d2643fae49789e6b378d6b1fd51f5.1619191723.git.mchehab+huawei@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <29ba3fafde4d2643fae49789e6b378d6b1fd51f5.1619191723.git.mchehab+huawei@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mauro, On Sat, Apr 24, 2021 at 08:44:16AM +0200, Mauro Carvalho Chehab wrote: > The pm_runtime_get_sync() internally increments the > dev->power.usage_count without decrementing it, even on errors. > replace it by the new pm_runtime_resume_and_get(), introduced by: Nit: 'Replace' as it follows a full stop ? > commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > in order to properly decrement the usage counter and avoid memory > leaks. > > While here, check if the PM runtime was caught at open time. Nit: Maybe "PM runtime error ..." or something similar as I'm missing the subject of the phrase. > > Signed-off-by: Mauro Carvalho Chehab > --- > drivers/media/platform/renesas-ceu.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c > index cd137101d41e..965a7259e707 100644 > --- a/drivers/media/platform/renesas-ceu.c > +++ b/drivers/media/platform/renesas-ceu.c > @@ -1099,7 +1099,10 @@ static int ceu_open(struct file *file) > > mutex_lock(&ceudev->mlock); > /* Causes soft-reset and sensor power on on first open */ > - pm_runtime_get_sync(ceudev->dev); > + ret = pm_runtime_resume_and_get(ceudev->dev); > + if (ret < 0) > + return ret; The mutex should be released before returning > + > mutex_unlock(&ceudev->mlock); > > return 0; > -- > 2.30.2 >