Received: by 10.213.65.68 with SMTP id h4csp336953imn; Fri, 16 Mar 2018 04:49:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELtD1N//NDLxcbKaGA/qCAhou1t2nDHlVgwsPWL5gpDy4ebHFczLG99zv7fvLv0aJgDI0iZN X-Received: by 2002:a17:902:5588:: with SMTP id g8-v6mr1779764pli.73.1521200969822; Fri, 16 Mar 2018 04:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521200969; cv=none; d=google.com; s=arc-20160816; b=YQyvehWp8TT9Dm0ANBn4wqfgFOKgr5WrkSXM4ohz5/8u/q/plqOH8zxWolm1lvDUaA aVRc/KNkdSlmYOiR19Gbt0akMfaXll1khqxYMF+TONQrdcdBcSXq6BY74U4IjOih/m7m r3gbZ6jrtyoy1AaDSlg7Lakl5C36Ja1FiOKlp/IfbTDLaAwlNK/D/siRjrhDJa3y71+k LwUANLSGPBQu1NEU00qZEOKG51+S4IWA9urXTqkoMRF46hYpUCnVrO6Rq9hmANEYpION 2jIjwPECjWE8iUc0tIdIFd/S5EzLjbA0VuEQ0r6aCSfQvPDl3Hc+fTzfdw6dEtdcMOjZ Fplw== 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 26si5376273pfl.261.2018.03.16.04.48.45; Fri, 16 Mar 2018 04:49:29 -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 S1753818AbeCPLpb (ORCPT + 99 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(-) 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; } -- 2.11.0