From patchwork Mon Jun 21 18:56:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12335507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-22.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75BE0C48BC2 for ; Mon, 21 Jun 2021 18:58:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4042D60FF2 for ; Mon, 21 Jun 2021 18:58:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4042D60FF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=S0/DBst4MQ6GHzveNRVQyecmbV2fP4g5v7xsAEfdNHI=; b=v/blRS/HHscOnK G7CUOLWxlOmEo6AvmOAKwcy0NZlU+HqYMv+UrcOrq/JSZateXfoQ0JfF788JH/YlOsJt9eUVVpfo4 aJk+GcI+bZYUud0KL2IR+2HBF71l5VnhixKDQ4dnlodoSS7XE0NhSSZNRHOlqIGF0uFy+j3FsG6B8 /4Iadavi9ak76zR/x4JzxvDbwTy2H5vNfYRLyeMlDLmdudNkNdnYh4lX7Xu9rXfTLFmstg9Df5SMO P/6sbgjdPWIiRP/anoijeQbdFcmSxBpf4hlE96k6U3xAHa7VdbtB8YchGk5IsmfY9gPacSiyj17Hv ri6K0dKvOynvq+C8WvFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvP6j-004faV-KS; Mon, 21 Jun 2021 18:57:17 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvP6g-004fZv-3u for linux-arm-kernel@lists.infradead.org; Mon, 21 Jun 2021 18:57:15 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 328A660FD8; Mon, 21 Jun 2021 18:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624301833; bh=lrJ17/MH7b8ugVfwgmUtFvEv2k5HUdeVJM3WvbL5QVk=; h=From:To:Cc:Subject:Date:From; b=BHt813KOyCGvKpnDMnw6vkE4oYv7xjlVboBOPJqz8kM+XtcylgclvhdneW78VEavH w3vIuetjtB2wV2DLzRLyoZs85UPlYnj9XuuEBv6MR4RUPMs1R2ScEH/ai48XFG/ciC 1dYzj8J/VVhOD3Oq7NZQjqKFdtL1AfkZg0W373ZG3aF4qwIKvYLnbpOHQ2ZuxKyGFW r5rmZQexTl/Q3ULa1miPPEqLaEE/wJ385jTh+/qleuPhbaBMB4XLp/0HR8W/McD6FF QQubcCOtnxfb44u40Wxj8CG8nRpskQJe8hgluFqZUWsbmYFqf9Z7wr4tu2OKmrAOfk 1E1fwu2a51I5A== From: Nathan Chancellor To: Jassi Brar , Peng Fan Cc: Shawn Guo , Sascha Hauer , kernel@pengutronix.de, Fabio Estevam , linux-imx@nxp.com, Nick Desaulniers , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [PATCH] mailbox: imx: Avoid using val uninitialized in imx_mu_isr() Date: Mon, 21 Jun 2021 11:56:45 -0700 Message-Id: <20210621185645.2373845-1-nathan@kernel.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890 MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210621_115714_217449_D1AB760F X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clang warns: drivers/mailbox/imx-mailbox.c:284:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ drivers/mailbox/imx-mailbox.c:288:7: note: uninitialized use occurs here if (!val) ^~~ drivers/mailbox/imx-mailbox.c:263:9: note: initialize the variable 'val' to silence this warning u32 val, ctrl; ^ = 0 1 warning generated. Prior to commit 91c8c1fbe498 ("mailbox: imx: add xSR/xCR register array"), val was always initialized in imx_mu_isr() but now, it is not initialized in the default case. Return IRQ_NONE like the statement below does and add a message that there is an unhandled type for this switch statement so that it can be updated. Fixes: 91c8c1fbe498 ("mailbox: imx: add xSR/xCR register array") Link: https://github.com/ClangBuiltLinux/linux/issues/1404 Signed-off-by: Nathan Chancellor --- drivers/mailbox/imx-mailbox.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) base-commit: 6393989e2a31914bdc50211ff350dade6c729ea7 diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index bc51bd3c1999..0ce75c6b36b6 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -282,7 +282,9 @@ static irqreturn_t imx_mu_isr(int irq, void *p) (ctrl & IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx)); break; default: - break; + dev_warn_ratelimited(priv->dev, "Unhandled channel type %d\n", + cp->type); + return IRQ_NONE; } if (!val)