[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YIgoOH04vO3KPSBs@hovoldconsulting.com>
Date: Tue, 27 Apr 2021 17:05:28 +0200
From: Johan Hovold <johan@...nel.org>
To: Julia Lawall <Julia.Lawall@...ia.fr>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
kernel-janitors@...r.kernel.org,
Gilles Muller <Gilles.Muller@...ia.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
Michal Marek <michal.lkml@...kovi.net>, cocci@...teme.lip6.fr,
linux-kernel@...r.kernel.org,
"Rafael J . Wysocki" <rafael@...nel.org>,
Zhang Qilong <zhangqilong3@...wei.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH v3] coccinelle: api: semantic patch to use
pm_runtime_resume_and_get
On Tue, Apr 27, 2021 at 02:58:34PM +0200, Julia Lawall wrote:
> pm_runtime_get_sync keeps a reference count on failure, which can lead
> to leaks. pm_runtime_resume_and_get drops the reference count in the
> failure case. This rule very conservatively follows the definition of
> pm_runtime_resume_and_get to address the cases where the reference
> count is unlikely to be needed in the failure case. Specifically, the
> change is only done when pm_runtime_get_sync is followed immediately
> by an if and when the branch of the if is immediately a call to
> pm_runtime_put_noidle (like in the definition of
> pm_runtime_resume_and_get) or something that is likely a print
> statement followed by a pm_runtime_resume_and_get call. The patch
s/pm_runtime_resume_and_get/pm_runtime_put_noidle/
> case appears somewhat more complicated, because it also deals with the
> cases where {}s need to be removed.
>
> pm_runtime_resume_and_get was introduced in
> commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
> deal with usage counter")
>
> Signed-off-by: Julia Lawall <Julia.Lawall@...ia.fr>
>
> ---
> v3: add the people who signed off on commit dd8088d5a896, expand the log message
> v2: better keyword
Johan
Powered by blists - more mailing lists