lkml.org 
[lkml]   [2021]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] PM: sleep: Fix error handling in dpm_prepare()
On Thu, 16 Dec 2021 at 20:30, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Commit 2aa36604e824 ("PM: sleep: Avoid calling put_device() under
> dpm_list_mtx") forgot to update the while () loop termination
> condition to also break the loop if error is nonzero, which
> causes the loop to become infinite if device_prepare() returns
> an error for one device.
>
> Add the missing !error check.
>
> Fixes: 2aa36604e824 ("PM: sleep: Avoid calling put_device() under dpm_list_mtx")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Thomas Hellström <thomas.hellstrom@linux.intel.com>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
> drivers/base/power/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-pm/drivers/base/power/main.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/main.c
> +++ linux-pm/drivers/base/power/main.c
> @@ -1902,7 +1902,7 @@ int dpm_prepare(pm_message_t state)
> device_block_probing();
>
> mutex_lock(&dpm_list_mtx);
> - while (!list_empty(&dpm_list)) {
> + while (!list_empty(&dpm_list) && !error) {
> struct device *dev = to_device(dpm_list.next);
>
> get_device(dev);
>
>
>

\
 
 \ /
  Last update: 2021-12-17 18:22    [W:0.037 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site