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: 131922 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp637075ljb; Fri, 16 Mar 2018 04:45:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELvjSVa3aaXQv5tq2Lxrl/6pa51kErLjhPxgbTBcW1FOaSG9vJEKFLZT/1QqtOIEn+ZdQMd3 X-Received: by 10.101.72.199 with SMTP id o7mr1222230pgs.303.1521200735763; Fri, 16 Mar 2018 04:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521200735; cv=none; d=google.com; s=arc-20160816; b=eOU6QJRdLX4C2rKog2TOIptjwu68g1PfBJRGDLRfDQ45vbWgeaebCdHBL1Dx9jgJQL 1JsBYfh+fz/5KB3btue2jl8kUwNBfahtW8yoh6lWPxxdrUoyKSnljrj91cw1yE76LcGu 9CSemE8kk8a2qOC4rzZc67oWXCRhchEzX7v8eJ7IP861ArtYyGVFfN1gVj2qUVB6FXHS h7wyB1pCxPX0MVQtkBjHU47Y5AQOFC0XwHtUgNSKpbiOibnCiAi+jc59lyRNAAUvphIh xfSmQqg/OypfSExNyUqznlkUm0QqF7jDFBk55QBN7lRFAl2bkCGVgazrzi1hHsJmpzLs I0TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=eGRbs0B2iLuYO6qCQa1+BH2yhCd2IYkV00DnwnHQfWI=; b=ZDGpEw3GRSiNfEIpmCo1YFFAZXLvnozfgFgieGqG4ARE+WmKiIdLFqoPfe+gxvPcIO 7L/y5ddY78fKme5C0mb42gSbgaPF85I4K3qK90Zx4f0QYK4XSKi6aAwfqfEt4paqtZU9 uj865+AcLMHAy6xowfBqvcCErtpiTeycN5uLyShDbfxrTYhikJgTw6dFw2pqwt+a6TPn sltgFRZIV7Jm95R9AX3uHixdt7ZY8uVqOO4q4lUEvS9IW+1fhimC+djOnN3k0KWddLso nIYpC87JVg+GhBBJtNMXM3ljnZqI4ozSwghTa/ucSS1oL74FhdZKYWiMM2SV2g6HedPi u15Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WGc9mD8a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11-v6si6182721pln.257.2018.03.16.04.45.35; Fri, 16 Mar 2018 04:45:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WGc9mD8a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753859AbeCPLpb (ORCPT + 28 others); Fri, 16 Mar 2018 07:45:31 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36530 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753282AbeCPLpa (ORCPT ); Fri, 16 Mar 2018 07:45:30 -0400 Received: by mail-lf0-f66.google.com with SMTP id z143-v6so8656090lff.3 for ; Fri, 16 Mar 2018 04:45:29 -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=M4gJbCu0ntIJKvJJVfZiAYDqidPEuQ1nN43LTmCAiNIdlsuU3GpLmDuyzAu9tdTWw+ DX10U9YOG44kX0DXXojj75AemQcHWtXnaeAlx9WR+SbEGmclJc+6nrztdrIpA2+kz4bX wQ2pn5JJHvxwtnS0UXJEoa0neGvZ2Pjty/utP4QJeGZLLoiXwb5Kt9reLQdqrkganqFM vj5cWrfEZECIHadMJ4r3H7Z04e64y1ZwAMdxfYImcQigBugOtxFtPzMu96PeV0GExRSw szyxt9LUxqzIaIZNz1B0mlYpSTIkKpOn1X6dx54YYs8EHxRg4GM84pFc57N0SEw/YLcz hFjg== X-Gm-Message-State: AElRT7HJ3ZP4Jn35F5RIJfwU9F9+qriGCnuXE/GOYTIKyTUK5yoHZTf3 1Z63OxuKKXlmt4xHwHCRVhdKkA== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Anders Roxell 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.11.0 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; }