PM / devfreq: Don't fail devfreq_dev_release if not in list
authorLeonard Crestez <leonard.crestez@nxp.com>
Wed, 13 Nov 2019 23:21:31 +0000 (01:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2020 09:17:50 +0000 (10:17 +0100)
commitb5f565ba27cbca21432d2cb8e2a2da905715ab7e
treeb6af650f71eb868e35628c18f99910ed54d163ea
parenteb9723e635d9d3cd5ea76d599933de710b9251c2
PM / devfreq: Don't fail devfreq_dev_release if not in list

[ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ]

Right now devfreq_dev_release will print a warning and abort the rest of
the cleanup if the devfreq instance is not part of the global
devfreq_list. But this is a valid scenario, for example it can happen if
the governor can't be found or on any other init error that happens
after device_register.

Initialize devfreq->node to an empty list head in devfreq_add_device so
that list_del becomes a safe noop inside devfreq_dev_release and we can
continue the rest of the cleanup.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/devfreq/devfreq.c