Received: by 10.192.165.148 with SMTP id m20csp3087511imm; Mon, 7 May 2018 06:29:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZocL+OJ84NPxYraAxk7HcSQq+5Vsudumz/B4APtAUIkD60F84XSD3us7mo6T0ibOhpTvLBZ X-Received: by 10.98.106.10 with SMTP id f10mr36289780pfc.99.1525699778848; Mon, 07 May 2018 06:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525699778; cv=none; d=google.com; s=arc-20160816; b=nZRwc4usfPxsAjwD+pBa/VRNfS5bWt3Zng2lmmHIjCoJEU7syrz+bWN9m8mCuKrZR/ BuBqiYHvM+XJihIYUggEQQlMQsRKligtWAs4d90M8uEaoHiqIBqQx8ncd3RcR7RjggUv VmHEal2l6C7Qvlus7Un0ViJfZosShpEAbV//zWEHKaOn9IpONw4WkMOSqMcxw/ZZi4iC /S+/uK+/Msd/AB3dgWj96XOvwuRh1Ie7ILRZgk2YKJg8xMTL8PA5A6f0085i3CEsL/hi iuonOzwVUuS+wv3F+DN1ZkBjyfbrBHDHOq9u0QcitrYS4A5x/ayixsNWLFR6ONEg+D+7 1Klw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=9YBk8OaLsjq4B8cqkdeXwZAD2QXFTuXMxhHEYB/Z9JQ=; b=T34IAtG/h9ccGHCeoqqolMWiti4BNECNExOKhUvoyrrrVMvt9loc4L9F/l3BClCmmC dAI+/pU/A3ScU0ZpIeYLPLYI42xO/wEL4NVMqu4HY3jEUSMEdf5kCvSWtVWjBxUJ3lfR e5w5TYSWPkBQ/5emy1fGCeLvM9Q0j/Tg5FxXr1X0vw1kOOTlS4UPx77gInzUnnt5TzVl oP4wafVoUemwnW0AJJldqIeQbqkD3Akx+kLIvNK5M4KLljSVyjzpCp6nMQb/azEhmqBy wgw8M9MregoyoF2xhk+UsYC5pl07vKQlNHD+nijEoLkPbdc0hr52RaGlJUImwdS6sC3s v7xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kO7TIs7f; 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 v4-v6si7660705plo.526.2018.05.07.06.29.24; Mon, 07 May 2018 06:29:38 -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=kO7TIs7f; 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 S1752407AbeEGN1j (ORCPT + 99 others); Mon, 7 May 2018 09:27:39 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:41864 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbeEGN1g (ORCPT ); Mon, 7 May 2018 09:27:36 -0400 Received: by mail-lf0-f68.google.com with SMTP id o123-v6so40597055lfe.8 for ; Mon, 07 May 2018 06:27:36 -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:mime-version :content-transfer-encoding; bh=9YBk8OaLsjq4B8cqkdeXwZAD2QXFTuXMxhHEYB/Z9JQ=; b=kO7TIs7fAWht9eaxroHnhMNHrs8U7aleJMuZTwy2MlokYhJNhWh5hrGM1QaRKL9sMa 5Z2jcCNCPZg8szKNzVsaq03dvUTtU9QFMafPP9wGdIcoTX8Vtu6vE1AEpYkh8HRhTavZ DWz/8LDrUZPaetMexnREYZghl8+GvEWUfZ+co= 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:mime-version :content-transfer-encoding; bh=9YBk8OaLsjq4B8cqkdeXwZAD2QXFTuXMxhHEYB/Z9JQ=; b=YEYEr9DZWuej/W0KBbrwn8LOnOtEbqemS7n/9zMhkQPpE1oDoFqPrtDRI70JbQ0wZW esTMuYJtP+biuSwDF1bHDlj+4V8hL3P1qW34exU7PjwFWtfH8SatTvQkblPqNGXi7n6W 9V2+/6FE/d/kOsWbwUZLyO7bdSpGM+yRalrI8laMessWdeCvcg7w6FfgNXdbpGzgBy1U B1q6TnQHXZRtmgnFQzgYbJYnyWQYSNVIvx2mw9Xg1/GqsU9Xtod2+MNTwAbBlynCSusV dIgLEjz5OKVHC8u2Ma2WuYoYa6JOM3h9+1IcZL1WFRqhMDdlFz304Y7asZeH7b6FN+L5 dd7g== X-Gm-Message-State: ALQs6tBB6rrIShX9mlJhDhv9D6SbtGES4E+yYmzEuZ9igKuOcItEh0Ig +mbVCzZ1Uku7Vltv8y5fjH2GAA== X-Received: by 2002:a19:f612:: with SMTP id x18-v6mr22157252lfe.60.1525699655480; Mon, 07 May 2018 06:27:35 -0700 (PDT) Received: from localhost (c-2c3d70d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.61.44]) by smtp.gmail.com with ESMTPSA id b79-v6sm1534634lfe.28.2018.05.07.06.27.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 06:27:34 -0700 (PDT) From: Anders Roxell To: andy.gross@linaro.org, david.brown@linaro.org Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH] soc: qcom: cmd-db: initialize struct to remove warning Date: Mon, 7 May 2018 15:27:24 +0200 Message-Id: <20180507132724.25846-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The struct isn't initialized, so gcc can't guarantee that the struct member is initialized thats why it says maybe-uninitialized. drivers/soc/qcom/cmd-db.c: In function ‘cmd_db_read_addr’: drivers/soc/qcom/cmd-db.c:194:21: warning: ‘ent.addr’ may be used uninitialized in this function [-Wmaybe-uninitialized] return ret < 0 ? 0 : le32_to_cpu(ent.addr); drivers/soc/qcom/cmd-db.c: In function ‘cmd_db_read_aux_data’: drivers/soc/qcom/cmd-db.c:221:10: warning: ‘ent.len’ may be used uninitialized in this function [-Wmaybe-uninitialized] ent_len = le16_to_cpu(ent.len); drivers/soc/qcom/cmd-db.c:226:15: warning: ‘*((void *)&rsc_hdr+4)’ may be used uninitialized in this function [-Wmaybe-uninitialized] memcpy(data, rsc_offset(&rsc_hdr, &ent), len); ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/soc/qcom/cmd-db.c:226:15: warning: ‘*((void *)&ent+22)’ may be used uninitialized in this function [-Wmaybe-uninitialized] CC drivers/mfd/pcf50633-irq.o drivers/soc/qcom/cmd-db.c: In function ‘cmd_db_read_aux_data_len’: drivers/soc/qcom/cmd-db.c:247:38: warning: ‘ent.len’ may be used uninitialized in this function [-Wmaybe-uninitialized] return ret < 0 ? 0 : le16_to_cpu(ent.len); ^ drivers/soc/qcom/cmd-db.c: In function ‘cmd_db_read_slave_id’: drivers/soc/qcom/cmd-db.c:269:7: warning: ‘ent.addr’ may be used uninitialized in this function [-Wmaybe-uninitialized] addr = le32_to_cpu(ent.addr); Initialize structs entry_header and rsc_hdr to remove the compile warning 'maybe-uninitialized'. Fixes: f22f5914c8c8 ("drivers: qcom: add command DB driver") Signed-off-by: Anders Roxell --- drivers/soc/qcom/cmd-db.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index a6f646295f06..1663dd1e46da 100644 --- a/drivers/soc/qcom/cmd-db.c +++ b/drivers/soc/qcom/cmd-db.c @@ -186,7 +186,7 @@ static int cmd_db_get_header(const char *id, struct entry_header *eh, u32 cmd_db_read_addr(const char *id) { int ret; - struct entry_header ent; + struct entry_header ent = {}; struct rsc_hdr rsc_hdr; ret = cmd_db_get_header(id, &ent, &rsc_hdr); @@ -207,8 +207,8 @@ EXPORT_SYMBOL(cmd_db_read_addr); int cmd_db_read_aux_data(const char *id, u8 *data, size_t len) { int ret; - struct entry_header ent; - struct rsc_hdr rsc_hdr; + struct entry_header ent = {}; + struct rsc_hdr rsc_hdr = {}; u16 ent_len; if (!data) @@ -239,7 +239,7 @@ EXPORT_SYMBOL(cmd_db_read_aux_data); size_t cmd_db_read_aux_data_len(const char *id) { int ret; - struct entry_header ent; + struct entry_header ent = {}; struct rsc_hdr rsc_hdr; ret = cmd_db_get_header(id, &ent, &rsc_hdr); @@ -258,7 +258,7 @@ EXPORT_SYMBOL(cmd_db_read_aux_data_len); enum cmd_db_hw_type cmd_db_read_slave_id(const char *id) { int ret; - struct entry_header ent; + struct entry_header ent = {}; struct rsc_hdr rsc_hdr; u32 addr; -- 2.17.0