From patchwork Wed Oct 10 14:13:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 10634615 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 7AD48933 for ; Wed, 10 Oct 2018 14:15:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E859C2A38C for ; Wed, 10 Oct 2018 14:15:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC4932A3A1; Wed, 10 Oct 2018 14:15:19 +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.9 required=2.0 tests=BAYES_00,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 88E2F2A38C for ; Wed, 10 Oct 2018 14:15:18 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4B9742678F3; Wed, 10 Oct 2018 16:15:16 +0200 (CEST) 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 69D3F267901; Wed, 10 Oct 2018 16:15:13 +0200 (CEST) Received: from gateway20.websitewelcome.com (gateway20.websitewelcome.com [192.185.49.40]) by alsa0.perex.cz (Postfix) with ESMTP id AE13F2678D9 for ; Wed, 10 Oct 2018 16:15:10 +0200 (CEST) Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway20.websitewelcome.com (Postfix) with ESMTP id E4F9D4014E5C9 for ; Wed, 10 Oct 2018 09:14:22 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id AFFMgC7XY8YaUAFFcgdiy7; Wed, 10 Oct 2018 09:14:22 -0500 X-Authority-Reason: nr=8 Received: from 57.154.24.109.rev.sfr.net ([109.24.154.57]:47408 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gAFFL-003fiJ-69; Wed, 10 Oct 2018 09:13:55 -0500 Date: Wed, 10 Oct 2018 16:13:53 +0200 From: "Gustavo A. R. Silva" To: Charles Keepax , Richard Fitzgerald , Linus Walleij Message-ID: <20181010141353.GA14382@embeddedor.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - alsa-project.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 109.24.154.57 X-Source-L: No X-Exim-ID: 1gAFFL-003fiJ-69 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 57.154.24.109.rev.sfr.net (embeddedor) [109.24.154.57]:47408 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 4 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [alsa-devel] [PATCH] pinctrl: madera: Fix uninitialized variable issue in madera_mux_set_mux 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP There is a potential execution path in which variable *ret* is checked in an IF statement, and then its value is used to report an error at line 659 without being properly initialized previously: 659 if (ret) 660 dev_err(priv->dev, "Failed to write to 0x%x (%d)\n", reg, ret); Fix this by initializing variable *ret* to -1. Addresses-Coverity-ID: 1471969 ("Uninitialized scalar variable") Fixes: 218d72a77b0b ("pinctrl: madera: Add driver for Cirrus Logic Madera codecs") Signed-off-by: Gustavo A. R. Silva --- drivers/pinctrl/cirrus/pinctrl-madera-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c index 0266302..a99ace8 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c +++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c @@ -608,7 +608,7 @@ static int madera_mux_set_mux(struct pinctrl_dev *pctldev, unsigned int n_chip_groups = priv->chip->n_pin_groups; const char *func_name = madera_mux_funcs[selector].name; unsigned int reg; - int i, ret; + int i, ret = -1; dev_dbg(priv->dev, "%s selecting %u (%s) for group %u (%s)\n", __func__, selector, func_name, group,