iio: magn: bmc150: Balance runtime pm + use pm_runtime_resume_and_get()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 9 May 2021 11:33:37 +0000 (12:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:05:39 +0000 (16:05 +0200)
commit1b1d6aa1a8cf924d31b8941f3dbd7f75b21f2768
tree79185bcbc297e2e21c0bddee405ff28aabffc8a3
parent5ecb0acc45e8b554d8849a0b75eae6ac60f7cfaf
iio: magn: bmc150: Balance runtime pm + use pm_runtime_resume_and_get()

[ Upstream commit 264da512431495e542fcaf56ffe75e7df0e7db74 ]

probe() error paths after runtime pm is enabled, should disable it.
remove() should not call pm_runtime_put_noidle() as there is no
matching get() to have raised the reference count.  This case
has no affect a the runtime pm core protects against going negative.

Whilst here use pm_runtime_resume_and_get() to tidy things up a little.
coccicheck script didn't get this one due to complex code structure so
found by inspection.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210509113354.660190-12-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/magnetometer/bmc150_magn.c