From patchwork Sun Jan 6 16:31:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Pakki X-Patchwork-Id: 10750057 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EB5E14DE for ; Mon, 7 Jan 2019 07:08:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CA2D28712 for ; Mon, 7 Jan 2019 07:08:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 811E628882; Mon, 7 Jan 2019 07:08:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0E5828712 for ; Mon, 7 Jan 2019 07:08:39 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C961C267B9C; Mon, 7 Jan 2019 08:07:19 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 77915267A69; Sun, 6 Jan 2019 17:32:02 +0100 (CET) Received: from mta-p5.oit.umn.edu (mta-p5.oit.umn.edu [134.84.196.205]) by alsa0.perex.cz (Postfix) with ESMTP id 9CFBC26789E for ; Sun, 6 Jan 2019 17:31:58 +0100 (CET) Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 39EB9AFC for ; Sun, 6 Jan 2019 16:31:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nu3qgYFPxSz6 for ; Sun, 6 Jan 2019 10:31:57 -0600 (CST) Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 0FE34A32 for ; Sun, 6 Jan 2019 10:31:56 -0600 (CST) Received: by mail-io1-f69.google.com with SMTP id h7so47175154iof.19 for ; Sun, 06 Jan 2019 08:31:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=l4JDFm4H97lFvVtPf5saGvZZu+kiKNt8Vw3PFyZO5jo=; b=ddEMDeFMdOC7t9w3aaEjvZTKe/Tai/WTMF8L1uRGKZvTbY+sf9j5LvoxyuDZJ7gDB1 uIcV79+/IH08TZ2PDlbEP1jsO3Ylh7mRBPosoUfGlUkHHiU48z5swzWfD89MaWvkKqY+ 97Vc/91YuttMGK0Rx5+YKNKwT20vKBnXy/YmQGw+VJgGU76UtQL64LNSGdwC5vQPlsAO 8ypQ6BVGpQaWNYOC/dn2et12nnLI/1aix68bj1XKbIsNOAf0Ofhck+E6kDL2E5Kb2+Wl F37o50Rdj5yd3or3HK0ZXjnltxKbjNwj7z0zVaBU60zwrTjLwhWPiYvlos1BJ9Zi+KYz fTvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=l4JDFm4H97lFvVtPf5saGvZZu+kiKNt8Vw3PFyZO5jo=; b=A78qFZio/nfpbY9xDM5OQSPq/ADrGcI+rsLUOn1HEz8djuXu31XLqXwcD2Vw+RwDPn DVJzwEhp4hKfuGovE6l3QesWmhncJbeRDpmK4tFxm/dBUftJmg0k1kKviIEWoG5YJa8x 2ORHfNX9atmhHvyLvpZIZfuYAaPuwIRPnwzbpmD+x19hYV27UM15nllzBG7AuAf7/83B QLXZK6fBhdfSPHdCIFN7m/CIi7aB3zTjCJBtr81sqKZiZbBoC9TPdLfuMHjPsw4BRH/g c3jkZVasAHW4JaEogrnaAVkOdlnRqDaESHzcSEf5avDTDBffAmBLiJWjBHOJTsVSf/sh U0Vw== X-Gm-Message-State: AJcUukeDe/PFBelJXQh2F9GsHpQplo5cs8YCTmiSZqe/ZbR55XVcY32h oIz9kOJhCqKiBXnf8O/kouT9lv19v5KD0oJPGMGnOrNDSsdbUE2c6Te7xzSbOdRui1Ka0GtXNKm m675cjRLXXambl3Ui2v9Xv5OdYoA= X-Received: by 2002:a24:7d93:: with SMTP id b141mr5304426itc.91.1546792315751; Sun, 06 Jan 2019 08:31:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN56Yp4WG8Sd2GuVj9Flyg4+RrCjepqh44IqLp53eg9pMbi2uqDmWy8WsdjE4nW/e95cE1YTdQ== X-Received: by 2002:a24:7d93:: with SMTP id b141mr5304405itc.91.1546792315320; Sun, 06 Jan 2019 08:31:55 -0800 (PST) Received: from cs-u-syssec1.cs.umn.edu (cs-u-syssec1.cs.umn.edu. [134.84.121.78]) by smtp.gmail.com with ESMTPSA id t2sm30654290iob.7.2019.01.06.08.31.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Jan 2019 08:31:54 -0800 (PST) From: Aditya Pakki To: pakki001@umn.edu Date: Sun, 6 Jan 2019 10:31:44 -0600 Message-Id: <20190106163146.9518-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Mon, 07 Jan 2019 08:06:57 +0100 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, kjlu@umn.edu, Takashi Iwai Subject: [alsa-devel] [PATCH] [v2] ALSA: ice1712: fix a missing check of snd_i2c_sendbytes X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Aditya Pakki --- sound/pci/ice1712/ews.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index b8af747ecb43..7646c93e8268 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c @@ -826,7 +826,12 @@ 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)) { + snd_i2c_unlock(ice->i2c); + dev_err(ice->card->dev, "cannot send pca\n"); + return -EIO; + } + byte = 0; if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { snd_i2c_unlock(ice->i2c);