iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get().
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 9 May 2021 11:33:27 +0000 (12:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:05:39 +0000 (16:05 +0200)
commit5ecb0acc45e8b554d8849a0b75eae6ac60f7cfaf
treea8420dc688a5274f6cc32abea561e6037d762ea2
parent5f69841c220aa7e43514d8aae494ba02852802cf
iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get().

[ Upstream commit 41120ebbb1eb5e9dec93320e259d5b2c93226073 ]

In both the probe() error path and remove() pm_runtime_put_noidle()
is called which will decrement the runtime pm reference count.
However, there is no matching function to have raised the reference count.
Not this isn't a fix as the runtime pm core will stop the reference count
going negative anyway.

An alternative would have been to raise the count in these paths, but
it is not clear why that would be necessary.

Whilst we are here replace some boilerplate with pm_runtime_resume_and_get()
Found using coccicheck script under review at:
https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210509113354.660190-2-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/gyro/fxas21002c_core.c