Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp777555ybc; Sat, 16 Nov 2019 08:30:49 -0800 (PST) X-Google-Smtp-Source: APXvYqz+zqCDDuBlNOdH4u2B6xF3NBakPtf9MRQIJM9wQygLR43X3AYy1ZCvEOlJhj8kCdeMqfy0 X-Received: by 2002:a17:906:85c8:: with SMTP id i8mr11327294ejy.46.1573921849758; Sat, 16 Nov 2019 08:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921849; cv=none; d=google.com; s=arc-20160816; b=jG1lT1VfM1x/9TcjvQkH1+uFGPR7mVEHdimqDUZlxKfryZgcNsvOHt1B78ilKtbGoU aGT3wVo4UBzya3ZZ/Z1kzk8p3/V35tlaZFX9bYhQatM0nRL1EPzXe2NVA29qSH16dO84 r7yi8bzco+xnUmYjRFde1EBXibUqOcyx79gthROxRuDGL3HmblsuXv/oWfTFvplBjWKE +JJ6WEe6SY+JB5Oi1dMIgdjRygIlXhy6DnNY55jKuq9vmNBMad8Ft7igVwNpf6FUC334 EN7Y0uRGPWrPxa4ZiDrBiXgrmmR5sN4WnVH8Sii0cs4O473gHvszCKULqabcG++mAb7i dxZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yqMWRJTS6dypA6zAZ5G7GwGfyoJ6u1t3JFw7vS1jKHk=; b=nx1nOZSVBiYLbSJ7RpuAvdA0lZYYLvpgWHJj50avok9SeBerCW68Gu5XpEaWqrf1gA mYRXPsAq8fhYWM9Q2IjIBsFsMouInzpXviQmd5amCmgdLQ7P/JVVLg6hpRs53WYPMsqZ eiRncRoQDZ+XeDJ1NrunKS5J5Dut1k7OjJfs5+DXTujn9k3GFCdBPngrUNAHrWfJv3Ul 60m6t4pWv/pnMmUQPogFM0k9yIoqFk1kSH4KrX3xV5Aad4LzqqHtGxW6Q/6//5D+SPXD mNCALujNdW4I0ADmeKhdpSjzn4UYKWoV+c95z52yy1ALP1oocDAdqCX3BFnRTN9b2xE6 K+QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0uD1gvp1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si7851812ejw.30.2019.11.16.08.30.25; Sat, 16 Nov 2019 08:30:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0uD1gvp1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727842AbfKPPlU (ORCPT + 99 others); Sat, 16 Nov 2019 10:41:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:44244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbfKPPlR (ORCPT ); Sat, 16 Nov 2019 10:41:17 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9936020740; Sat, 16 Nov 2019 15:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573918877; bh=hQREgqaink3iuJiBJ6qFVYV+ZcjGT3/g+cK8dXTXJjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0uD1gvp1ZST0epJCDOaT2KKMAgVHMfn0yZWSzWqNkIPORrhlfE0GMh7rRqM/0ZhLz DJF3LvGv0uodV0Fd9MLL4Y3QYGTX2wsu9tzZnnmydS6oekJDADyn62yHaaI/GI0I1a KUTg1+fyZem3oZkzYPAt7UF/4qH2g6Fvn6ljXxkY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Gustavo A. R. Silva" , Charles Keepax , Linus Walleij , Sasha Levin , patches@opensource.cirrus.com, linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 005/237] pinctrl: madera: Fix uninitialized variable bug in madera_mux_set_mux Date: Sat, 16 Nov 2019 10:37:20 -0500 Message-Id: <20191116154113.7417-5-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Gustavo A. R. Silva" [ Upstream commit 4fe81669df50889ff1072c030c59df5f1fa6534e ] 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 0 in order to avoid unpredictable or unintended results. 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 Acked-by: Charles Keepax Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- 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 c4f4d904e4a61..618e04407ac85 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 = 0; dev_dbg(priv->dev, "%s selecting %u (%s) for group %u (%s)\n", __func__, selector, func_name, group, -- 2.20.1