mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
iio: adc: mcp3422: fix locking on error path
Reading from the chip should be unlocked on error path else the lock could never being released. Fixes:07914c84ba
("iio: adc: Add driver for Microchip MCP3422/3/4 high resolution ADC") Fixes:3f1093d83d
("iio: adc: mcp3422: fix locking scope") Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Link: https://lore.kernel.org/r/20200901093218.1500845-1-angelo.compagnucci@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c96711e138
commit
a139ffa40f
1 changed files with 3 additions and 1 deletions
|
@ -143,8 +143,10 @@ static int mcp3422_read_channel(struct mcp3422 *adc,
|
|||
config &= ~MCP3422_PGA_MASK;
|
||||
config |= MCP3422_PGA_VALUE(adc->pga[req_channel]);
|
||||
ret = mcp3422_update_config(adc, config);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
mutex_unlock(&adc->lock);
|
||||
return ret;
|
||||
}
|
||||
msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue