Message ID | 20200915140634.010489871@linuxfoundation.org |
---|---|
State | Superseded |
Headers | show |
Series | None | expand |
Hi! > [ Upstream commit a139ffa40f0c24b753838b8ef3dcf6ad10eb7854 ] > > Reading from the chip should be unlocked on error path else the lock > could never being released. > > Fixes: 07914c84ba30 ("iio: adc: Add driver for Microchip MCP3422/3/4 high resolution ADC") > Fixes: 3f1093d83d71 ("iio: adc: mcp3422: fix locking scope") Well, 3f1093d83d71 is only applied later in the stable series, so this introduces spurious unlock. Ideally this should go just after 3f1093d83d71 ("iio: adc: mcp3422: fix locking scope"). Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed, Sep 16, 2020 at 09:31:00AM +0200, Pavel Machek wrote: >Hi! > >> [ Upstream commit a139ffa40f0c24b753838b8ef3dcf6ad10eb7854 ] >> >> Reading from the chip should be unlocked on error path else the lock >> could never being released. >> >> Fixes: 07914c84ba30 ("iio: adc: Add driver for Microchip MCP3422/3/4 high resolution ADC") >> Fixes: 3f1093d83d71 ("iio: adc: mcp3422: fix locking scope") > >Well, 3f1093d83d71 is only applied later in the stable series, so this >introduces spurious unlock. > >Ideally this should go just after 3f1093d83d71 ("iio: adc: mcp3422: >fix locking scope"). Patches rearranged, thanks! -- Thanks, Sasha
diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c index 819f260115005..a5a687257c0b8 100644 --- a/drivers/iio/adc/mcp3422.c +++ b/drivers/iio/adc/mcp3422.c @@ -148,8 +148,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)]); }