Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: sh: rz-ssi: Check return value of pm_runtime_resume_and_get()

The return value of pm_runtime_resume_and_get() needs to be checked to
avoid a usage count imbalance in the error case. This fix is basically
the same as 92c959bae2e5 ("reset: renesas: Fix Runtime PM usage"),
and the last step before pm_runtime_resume_and_get() can be annotated
as __must_check.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/9fed506d-b780-55cd-45a4-9bd2407c910f@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Heiner Kallweit and committed by
Mark Brown
f04b4fb4 4941cd7c

+6 -1
+6 -1
sound/soc/sh/rz-ssi.c
··· 1020 1020 1021 1021 reset_control_deassert(ssi->rstc); 1022 1022 pm_runtime_enable(&pdev->dev); 1023 - pm_runtime_resume_and_get(&pdev->dev); 1023 + ret = pm_runtime_resume_and_get(&pdev->dev); 1024 + if (ret < 0) { 1025 + pm_runtime_disable(ssi->dev); 1026 + reset_control_assert(ssi->rstc); 1027 + return dev_err_probe(ssi->dev, ret, "pm_runtime_resume_and_get failed\n"); 1028 + } 1024 1029 1025 1030 spin_lock_init(&ssi->lock); 1026 1031 dev_set_drvdata(&pdev->dev, ssi);