hwmon: (pmbus/core) mutex_lock write in pmbus_set_samples
authorAdamski, Krzysztof (Nokia - PL/Wroclaw) <krzysztof.adamski@nokia.com>
Wed, 29 May 2019 14:33:52 +0000 (14:33 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 6 Jun 2019 01:36:27 +0000 (18:36 -0700)
commit38463721ec3c39acdabed3a89016ce6bb32a7543
tree4154a311c4aee5f43ada5b80fc0e148bec4c5b58
parentc41dd48e21fae3e55b3670ccf2eb562fc1f6a67d
hwmon: (pmbus/core) mutex_lock write in pmbus_set_samples

update_lock is a mutex intended to protect write operations. It was not
taken, however, when _pmbus_write_word_data is called from
pmbus_set_samples() function which may cause problems especially when
some PMBUS_VIRT_* operation is implemented as a read-modify-write cycle.

This patch makes sure the lock is held during the operation.

Fixes: 49c4455dccf2 ("hwmon: (pmbus) Introduce PMBUS_VIRT_*_SAMPLES registers")
Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
[groeck: Declared and initialized missing 'data' variable]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus_core.c