From patchwork Sun Sep 3 13:06:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 9936319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A9E8603D7 for ; Sun, 3 Sep 2017 13:06:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C86F286B0 for ; Sun, 3 Sep 2017 13:06:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5099B286B4; Sun, 3 Sep 2017 13:06:57 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B6F7286B0 for ; Sun, 3 Sep 2017 13:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752860AbdICNGG (ORCPT ); Sun, 3 Sep 2017 09:06:06 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:41023 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157AbdICNGF (ORCPT ); Sun, 3 Sep 2017 09:06:05 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1doUbB-0005Wh-OU; Sun, 03 Sep 2017 13:06:01 +0000 From: Colin King To: Ohad Ben-Cohen , Bjorn Andersson , linux-remoteproc@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rpmsg: glink: initialize ret to zero to ensure error status check is correct Date: Sun, 3 Sep 2017 14:06:01 +0100 Message-Id: <20170903130601.6533-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King The new switch cases for RPM_CMD_RX_DONE, RPM_CMD_RX_DONE_W_REUSE, RPM_CMD_RX_INTENT_REQ_ACK, RPM_CMD_INTENT and RPM_CMD_RX_INTENT_REQ from 4 recent commits are not setting ret and so a later non-zero check on ret is testing on a garbage value in ret. Fix this by initializing ret to zero. Detected by CoverityScan CID#1455249 ("Uninitialized scalar variable") Fixes: 933b45da5d1d ("rpmsg: glink: Add support for TX intents) Fixes: dacbb35e930f ("glink: Receive and store the remote intent buffers") Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable") Fixes: 88c6060f5a7f ("rpmsg: glink: Handle remote rx done command") Signed-off-by: Colin Ian King --- drivers/rpmsg/qcom_glink_native.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 8bc0d0456a40..5a5e927ea50f 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -957,7 +957,7 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data) unsigned int param2; unsigned int avail; unsigned int cmd; - int ret; + int ret = 0; for (;;) { avail = qcom_glink_rx_avail(glink); @@ -994,8 +994,6 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data) mbox_send_message(glink->mbox_chan, NULL); mbox_client_txdone(glink->mbox_chan, 0); - - ret = 0; break; case RPM_CMD_INTENT: qcom_glink_handle_intent(glink, param1, param2, avail);