crypto: stm32 - Properly handle pm_runtime_get failing
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 31 Jul 2023 16:54:54 +0000 (18:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:32 +0000 (09:42 +0200)
commit501f77cfce8a60d583ce20a0c3f3a3eee3e5521a
tree58dad31ae5d4bef1bc34e1a1bd731bb1ae2c3265
parent6fc09c8d765ee8f0ca37e29fa96498e77307a5df
crypto: stm32 - Properly handle pm_runtime_get failing

[ Upstream commit aec48805163338f8413118796c1dd035661b9140 ]

If pm_runtime_get() (disguised as pm_runtime_resume_and_get()) fails, this
means the clk wasn't prepared and enabled. Returning early in this case
however is wrong as then the following resource frees are skipped and this
is never catched up. So do all the cleanups but clk_disable_unprepare().

Also don't emit a warning, as stm32_hash_runtime_resume() already emitted
one.

Note that the return value of stm32_hash_remove() is mostly ignored by
the device core. The only effect of returning zero instead of an error
value is to suppress another warning in platform_remove(). So return 0
even if pm_runtime_resume_and_get() failed.

Fixes: 8b4d566de6a5 ("crypto: stm32/hash - Add power management support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/stm32/stm32-hash.c