From patchwork Fri Mar 16 11:44:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10286959 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 6DE45602C2 for ; Fri, 16 Mar 2018 11:45:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DA9228E22 for ; Fri, 16 Mar 2018 11:45:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 509BC28E25; Fri, 16 Mar 2018 11:45:52 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 4B89A28E22 for ; Fri, 16 Mar 2018 11:45:51 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=Om9Hks60Ta6c8o/w758A48bHsk2aasRQ2l3dakwwsIA=; b=Gyb wmCYBd1/mSoMJm+6kCaO6uiV4LFOG72Zxa4wFMtg6/Sfu4S4mLWujWZJKoysVlubJuGSbVg8G7y29 v81svI7SXT7sK46slUs904XZizbwrLiJWNTqRO4ZB6hHPtYo8hiwpZTUPkSGyQvdkHqUE0BgVrU+z DbEJq+2KHdoyPETo9flkmARHgx+2uQgODcKP60N3NgX6eyTn+7xIwQqhhRVKF5Nril1qQrHQVigwE akJa6TeH61XqBsWbsJKyZMNmIgG2dYq6gqPPDZOWwYX1kPp07UecyVWiOV1x2y0joxxR8jGRyUBeE h6If6RyeEfNPCJSGZjCjRWW9oKhNoQQ==; 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 1ewnns-000873-U3; Fri, 16 Mar 2018 11:45:44 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewnno-00085U-RF for linux-arm-kernel@lists.infradead.org; Fri, 16 Mar 2018 11:45:42 +0000 Received: by mail-lf0-x242.google.com with SMTP id l191-v6so14934391lfe.1 for ; Fri, 16 Mar 2018 04:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=eGRbs0B2iLuYO6qCQa1+BH2yhCd2IYkV00DnwnHQfWI=; b=WGc9mD8asdtt5khna40JSDPX13g41LzgKX9hg6SQPrRDC0K02B2vIAWk+Y1sUwNdCe /SCzjKyJ7YK2oE1usmspO3X3wP7bCrWooYCXyYjJFQQlz7VRqpiXVhlqur6N+HcACFi4 srTV0A2Jd8YqR+2b9r9X2TepF+ffXRQhL4CpQ= 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; bh=eGRbs0B2iLuYO6qCQa1+BH2yhCd2IYkV00DnwnHQfWI=; b=eNtoggmA3ZC6e8WKUZzRdJBnqitOuzG/DagFEei5oOyqlcxTm1q9fMi0mlHem0c4EX AMdqCXpjFAuvTRSxirMSH8Gbrg79nNDj5BadyYfe38HVwqHWuORarUFe3ZcJ7/W9Rz/1 RNF8zZv+tdQOsZjUrnvv0v35Id7A8qvFBgqcV8SJeOPsuD2N8w7brZYagwPtsmZ6T0Sr 3FM5CoTGVb6Kgik1qO0tDA8IX2fLXoawDGeYfQTBqv7Qlp7bfxwMZAM7LmnXSqGtv6Fc tfsmSOwDdAOJnFCq0DaQDrshe/6xqs7DFcG8r6p9aKJP/lFdLPrwoG9ge6ZFC/DO7G3o wicg== X-Gm-Message-State: AElRT7FX5NzrhjO4SuWoHtcqyYgNp4aknGGrfvzVeT0Wvkc1bkfSW6rl h8Q9TZUFXHqUOGyx8rV89lwNrw== X-Google-Smtp-Source: AG47ELuKT6ei83MrzswZ/qO7URjj01dhMX6+XLmOAshwgyeikN/XAOPI0XonD2DOuJ2YcXqbKLcV4A== X-Received: by 2002:a19:9d93:: with SMTP id g141-v6mr1113381lfe.142.1521200728743; Fri, 16 Mar 2018 04:45:28 -0700 (PDT) Received: from localhost (c-4f661568-74736162.cust.telenor.se. [79.102.21.104]) by smtp.gmail.com with ESMTPSA id s12sm1578545ljs.92.2018.03.16.04.45.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Mar 2018 04:45:27 -0700 (PDT) From: Anders Roxell To: sudeep.holla@arm.com Subject: [PATCH] firmware: arm_scmi: prevent accessing rate_discrete uninitialized Date: Fri, 16 Mar 2018 12:44:42 +0100 Message-Id: <20180316114442.9536-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180316_044541_075956_45309760 X-CRM114-Status: GOOD ( 11.69 ) 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: Anders Roxell , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 gcc-5.3 and earlier warns that rate_discrete maybe-uninitialized ../drivers/firmware/arm_scmi/clock.c:185:5: warning: 'rate_discrete' may be used uninitialized in this function [-Wmaybe-uninitialized] if (rate_discrete) ^ ../drivers/firmware/arm_scmi/clock.c:128:7: note: 'rate_discrete' was declared here bool rate_discrete; ^ Fixes: 5f6c6430e904 ("firmware: arm_scmi: add initial support for clock protocol") Signed-off-by: Anders Roxell --- drivers/firmware/arm_scmi/clock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index e8ffad33a0ff..e6f17825db79 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -125,7 +125,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id, { u64 *rate; int ret, cnt; - bool rate_discrete; + bool rate_discrete = false; u32 tot_rate_cnt = 0, rates_flag; u16 num_returned, num_remaining; struct scmi_xfer *t; @@ -147,7 +147,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id, ret = scmi_do_xfer(handle, t); if (ret) - break; + goto err; rates_flag = le32_to_cpu(rlist->num_rates_flags); num_remaining = NUM_REMAINING(rates_flag); @@ -185,6 +185,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id, if (rate_discrete) clk->list.num_rates = tot_rate_cnt; +err: scmi_one_xfer_put(handle, t); return ret; }