From patchwork Mon Apr 20 11:15:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 6241451 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 392B5BF4A6 for ; Mon, 20 Apr 2015 11:17:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54217203E3 for ; Mon, 20 Apr 2015 11:17:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A86C203E1 for ; Mon, 20 Apr 2015 11:17:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yk9hy-0007v7-Vd; Mon, 20 Apr 2015 11:17:46 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yk9ho-0007rT-KQ; Mon, 20 Apr 2015 11:17:37 +0000 Received: from [10.172.193.212] (helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Yk9hJ-0005vj-AV; Mon, 20 Apr 2015 11:17:05 +0000 From: Colin King To: Linus Walleij , Matthias Brugger , Hongzhou Yang , Yingjoe Chen , Maoguang Meng , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] pinctrl: mediatek: mtk-common: initialize unmask Date: Mon, 20 Apr 2015 06:15:16 -0500 Message-Id: <1429528516-9245-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150420_041736_869268_691BBA0C X-CRM114-Status: UNSURE ( 7.04 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) Cc: linux-kernel@vger.kernel.org X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King cppcheck detected an unitialized variable: [drivers/pinctrl/mediatek/pinctrl-mtk-common.c:897]: (error) Uninitialized variable: unmask unmask should be initialized to zero to ensure unmasking only occurs if a previous mask occurred. The current situation is that the unmask variable could contain any random garbage causing random unexpected unmasking. Signed-off-by: Colin Ian King --- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index 493294c..3173125 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -881,7 +881,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, if (!mtk_eint_get_mask(pctl, eint_num)) { mtk_eint_mask(d); unmask = 1; - } + } else + unmask = 0; clr_bit = 0xff << eint_offset; writel(clr_bit, pctl->eint_reg_base + clr_offset);