From patchwork Thu Mar 7 22:56:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10843937 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 0AAD0139A for ; Thu, 7 Mar 2019 22:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6C382F5D9 for ; Thu, 7 Mar 2019 22:58:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D92902F5E1; Thu, 7 Mar 2019 22:58:06 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B3DC2F5D9 for ; Thu, 7 Mar 2019 22:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=yeiet0t5bKR9STW1Ej7ut31nSMPuWyYfRu6KyQhrbYQ=; b=JRWWiMXzKoLWil o9SqudWuUDxXAQ2HNIx3rtQ8d+k9jl0ByTJha6Y31u6l4IT5cSh6P46w5HF2q5udEt5PCHrH3tvOz 0pJzEY3gjl55x7hxI2VNZXlczcva4TbJmTuZaups47bzjRfYawhyFSFZR5pG8ZKiLm8nJA56e6Fv6 RF86YOIGTqLGAHunjsEmMw5BlmRU6d57iEp1oNGTNPaYzGnIsDhwTPGeFUeeLxBjUxv45OMy6/e1l MJ7ZvdcbhjgG8iYRz04bfElOZPuENNcKSUkYVbOOgKcZGZMuTtiyfcRUBEnN62r3dARKP7USuCw1P mLqAOFORalp+j2RDN85w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h21xg-00030x-5t; Thu, 07 Mar 2019 22:58:00 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h21xd-00030X-4d; Thu, 07 Mar 2019 22:57:58 +0000 Received: by mail-ed1-x544.google.com with SMTP id j89so14881104edb.9; Thu, 07 Mar 2019 14:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pGjv/3pODjN3UGu8v7Yv7AK9caCX13/af8mLLqsaVkc=; b=nZSTLqL0EhIPZprSM5gpKnHr3bjGN/nv6wyISQIsbo5sJJ6az0E2KVXDoJFv8gHdcl QuohliPHxRZQkFICPLdQpcyxHOhLUXZ2l5MQGdCAHREAKrq7gURsCM9MURQleaU4oiI8 6SbQwK0BTKp7FYEWA1f4tXHsPoA3OugqQFc9wjuSaDJN+b3h48BocYjlVel0ZQXShImc beLYq7RRr+liLf20jjsMJnFdHRbslgGhKb9BSiIhD4mqujOtath9MLcTjU3m1zFE79To mHidQfvLQ46HxagU/WTHRhPbbRtqL8pR1+P40Ly8IEoJvqteqNbPl+Fsxr9AR2CzopXg SJHw== 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:mime-version :content-transfer-encoding; bh=pGjv/3pODjN3UGu8v7Yv7AK9caCX13/af8mLLqsaVkc=; b=A2QDCQa9dD7kwdVUM2NJqNR2Yvxx9SMBRBiOrOj54j+HJUWf1vGwWsqhe4aVfmH8hx WcNVwRqYv3DFBMThGBmD7YIxqsXfncOx2iHzVVsE7fyU7MIJXAOUP9OVTNfgpxlU0qOn qrcoEoUfwovD6nu1tzU/RiHeg89fNoutRpeaHODdNwvtVZQUnjA48RhXnQUHmmC9y1ob WeUvSwNX84k40PJv4pmTEmDliwsa/xS//VvqKcS5BfROYhD/WyCzspoAyy6emS72nFdw alBzHG1BU/sdOR6qIbcAGR19gS839+PFYkIW6jKyB+rzC7W0otvu0+MHz5fKCQOwZ5G5 EUSA== X-Gm-Message-State: APjAAAW7Wo3djKsG5rbDiBhryihdmrBPjG3RbeSBjUvpg9Fia+k4Ugks LkxPVyGmWpOLpr07QEv252gGw41umAA2gg== X-Google-Smtp-Source: APXvYqxLFWrA80ZzRe+AdXNM0Le8/H4fNU5GZ73kqByUGv0JtpEcLXVvO18kxp82eDvRSAoE6J1+Cg== X-Received: by 2002:a17:906:6a49:: with SMTP id n9mr9202032ejs.30.1551999474803; Thu, 07 Mar 2019 14:57:54 -0800 (PST) Received: from localhost.localdomain ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id g31sm1709941edb.45.2019.03.07.14.57.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 14:57:54 -0800 (PST) From: Nathan Chancellor To: Matthias Brugger Subject: [PATCH] soc: mediatek: pwrap: Zero initialize rdata in pwrap_init_cipher Date: Thu, 7 Mar 2019 15:56:51 -0700 Message-Id: <20190307225650.23001-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190307_145757_207911_E7326D87 X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, linux-mediatek@lists.infradead.org, Nathan Chancellor , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When building with -Wsometimes-uninitialized, Clang warns: drivers/soc/mediatek/mtk-pmic-wrap.c:1358:6: error: variable 'rdata' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized] If pwrap_write returns non-zero, pwrap_read will not be called to initialize rdata, meaning that we will use some random uninitialized stack value in our print statement. Zero initialize rdata in case this happens. Link: https://github.com/ClangBuiltLinux/linux/issues/401 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Reviewed-by: Arnd Bergmann --- I don't know if this is better or to just restructure the if statement below (I'm not an expert in this code so I'll leave that up to the maintainers to decide). drivers/soc/mediatek/mtk-pmic-wrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index 8236a6c87e19..2f632e8790f7 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -1281,7 +1281,7 @@ static bool pwrap_is_pmic_cipher_ready(struct pmic_wrapper *wrp) static int pwrap_init_cipher(struct pmic_wrapper *wrp) { int ret; - u32 rdata; + u32 rdata = 0; pwrap_writel(wrp, 0x1, PWRAP_CIPHER_SWRST); pwrap_writel(wrp, 0x0, PWRAP_CIPHER_SWRST);