From patchwork Fri Dec 4 19:37:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11952209 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=-17.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 D718CC4361B for ; Fri, 4 Dec 2020 19:38:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8ADCE22CAF for ; Fri, 4 Dec 2020 19:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730806AbgLDTi0 (ORCPT ); Fri, 4 Dec 2020 14:38:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:60484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727661AbgLDTi0 (ORCPT ); Fri, 4 Dec 2020 14:38:26 -0500 From: Arnd Bergmann Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Andy Gross , Bjorn Andersson , Ohad Ben-Cohen , Rishabh Bhatnagar Cc: Arnd Bergmann , Siddharth Gupta , Mathieu Poirier , Ma Feng , Rikard Falkeborn , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] remoteproc: sysmon: fix shutdown_acked state Date: Fri, 4 Dec 2020 20:37:35 +0100 Message-Id: <20201204193740.3162065-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Arnd Bergmann The latest version of sysmon_stop() starts by initializing the sysmon->shutdown_acked variable, but then overwrites it with an uninitialized variable later: drivers/remoteproc/qcom_sysmon.c:551:11: error: variable 'acked' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] else if (sysmon->ept) ^~~~~~~~~~~ drivers/remoteproc/qcom_sysmon.c:554:27: note: uninitialized use occurs here sysmon->shutdown_acked = acked; ^~~~~ Remove the local 'acked' variable again and set the state directly. Fixes: 5c212aaf5457 ("remoteproc: sysmon: Expose the shutdown result") Signed-off-by: Arnd Bergmann --- drivers/remoteproc/qcom_sysmon.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index d01bc4bda7bf..9fca81492863 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -533,7 +533,6 @@ static void sysmon_stop(struct rproc_subdev *subdev, bool crashed) .subsys_name = sysmon->name, .ssr_event = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN }; - bool acked; sysmon->shutdown_acked = false; @@ -547,11 +546,9 @@ static void sysmon_stop(struct rproc_subdev *subdev, bool crashed) return; if (sysmon->ssctl_version) - acked = ssctl_request_shutdown(sysmon); + sysmon->shutdown_acked = ssctl_request_shutdown(sysmon); else if (sysmon->ept) - acked = sysmon_request_shutdown(sysmon); - - sysmon->shutdown_acked = acked; + sysmon->shutdown_acked = sysmon_request_shutdown(sysmon); } static void sysmon_unprepare(struct rproc_subdev *subdev)