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

iio: light: rpr0521: Balance runtime pm + use pm_runtime_resume_and_get()

Calls to pm_runtime_put_noidle in probe() error path and remove() are
not match to any get() calls.

The runtime pm core protects against negative reference counts, so this
doesn't have any visible impact beyond confusing the reader.

Whilst here use pm_runtime_resume_and_get() to replace boilerplate.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210509113354.660190-11-jic23@kernel.org

+1 -6
+1 -6
drivers/iio/light/rpr0521.c
··· 360 360 * both stay enabled until _suspend(). 361 361 */ 362 362 if (on) { 363 - ret = pm_runtime_get_sync(&data->client->dev); 363 + ret = pm_runtime_resume_and_get(&data->client->dev); 364 364 } else { 365 365 pm_runtime_mark_last_busy(&data->client->dev); 366 366 ret = pm_runtime_put_autosuspend(&data->client->dev); ··· 369 369 dev_err(&data->client->dev, 370 370 "Failed: rpr0521_set_power_state for %d, ret %d\n", 371 371 on, ret); 372 - if (on) 373 - pm_runtime_put_noidle(&data->client->dev); 374 - 375 372 return ret; 376 373 } 377 374 ··· 1035 1038 err_pm_disable: 1036 1039 pm_runtime_disable(&client->dev); 1037 1040 pm_runtime_set_suspended(&client->dev); 1038 - pm_runtime_put_noidle(&client->dev); 1039 1041 err_poweroff: 1040 1042 rpr0521_poweroff(data); 1041 1043 ··· 1049 1053 1050 1054 pm_runtime_disable(&client->dev); 1051 1055 pm_runtime_set_suspended(&client->dev); 1052 - pm_runtime_put_noidle(&client->dev); 1053 1056 1054 1057 rpr0521_poweroff(iio_priv(indio_dev)); 1055 1058