From: Takashi Iwai Subject: Re: [PATCH] pci: fix a missing check of snd_i2c_sendbytes Date: Tue, 01 Jan 2019 10:02:09 +0100 Message-ID: References: <20181226051206.74467-1-kjlu@umn.edu> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <20181226051206.74467-1-kjlu@umn.edu> Sender: linux-kernel-owner@vger.kernel.org To: Kangjie Lu Cc: alsa-devel@alsa-project.org, Jaroslav Kysela , pakki001@umn.edu, linux-kernel@vger.kernel.org List-Id: alsa-devel@alsa-project.org On Wed, 26 Dec 2018 06:12:04 +0100, Kangjie Lu wrote: > > snd_i2c_sendbytes could fail. The fix checks its return value: if it > fails, issues an error message and returns with its error code. > > Signed-off-by: Kangjie Lu > --- > sound/pci/ice1712/ews.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c > index b8af747ecb43..b978cdb0fc20 100644 > --- a/sound/pci/ice1712/ews.c > +++ b/sound/pci/ice1712/ews.c > @@ -826,7 +826,10 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg > > snd_i2c_lock(ice->i2c); > byte = reg; > - snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1); > + if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1)) { > + dev_err(ice->card->dev, "cannot send pca\n"); > + return -EIO; You forgot to unlock before returning. thanks, Takashi