From patchwork Mon May 7 13:27:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 135097 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3167140lji; Mon, 7 May 2018 06:27:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrf36N66n4NLTzX0S5Q1V6/CrVPyh5EnB9tZchDoLI4cTmoS6QSHdtTUwzlqvAQAhaHglE3 X-Received: by 2002:a63:981a:: with SMTP id q26-v6mr31128321pgd.40.1525699659592; Mon, 07 May 2018 06:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525699659; cv=none; d=google.com; s=arc-20160816; b=Qe7UcGf2JSYaX19uU6VK4iNhrU1mb6gi9VCs+143OvHU90ViytKUNA48S4hVbghpgP 0AFEhWolr0uVpIBK40D1cEMs0aa+KXusQgImylEgQwcbGUGlb79VFuCHSNsai+wOh38D idtIe79LrTbvZ0Etwr4aPUJJ6X8gyPxaKCVbG6bpC7yRmnYOdckNp69BWALNz1H9L4Kl kvYvfGrzMx2RmTqdhq5cno/LjL4IpJ+0Ld9uHhHzoyi/jdcV9FiDNyqfrcik5SZi5NLA 4dLNwYwNy5kzPO4HxN0TyXug9mLHHJsaDuHGcQC9KiGxgb8loNyiUb0DcaQ8ogGrghzw fK4A== 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=Oi6LgnOO/aAIfLnH98xRW8PfTzJYhzrDP2nYZN/ME/k=; b=Ch7IcENs8XtvIjbwYpn6jkFGDjTaXn7L9ctZUzyL4WJlLlL34rBGf1Vckwof4NfhYk +6WnSA5QGK4kYZpFus8Ffj8tjWy99JgyK33imakBEEG+zj6Eidcnf8K1AgSqf7lG5UEu zrv2pXBa15HbYQB7O3mpT3uV/DMxbjBO7LvmpE2N9zeQ+xqF2Gxf09BKmxlJvOZEq3yn 5U8dqS67mqhM4cgURNImavk9FNwHvYBq2Rjdu8kO6nbcIZMHwbHnrQC0yTxqn5G4V6ui BHLBiu08rTLvEgxNZnskASz0m3ELFX1ftp/g+mWxKc0dY7S4nD7r7ITvfsQzV6gnAexa EtAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kO7TIs7f; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 b21-v6si22404126pls.398.2018.05.07.06.27.39; Mon, 07 May 2018 06:27:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kO7TIs7f; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752217AbeEGN1i (ORCPT + 12 others); Mon, 7 May 2018 09:27:38 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:38967 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751923AbeEGN1h (ORCPT ); Mon, 7 May 2018 09:27:37 -0400 Received: by mail-lf0-f66.google.com with SMTP id j193-v6so40610222lfg.6 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=qLmSyBBJ35OSZem/2iwcipHLEOVZLUrwJQ5k0PBqKTMD3E3Ksxsah3CzvretE+dzbw gF+Fe7Zqo8FJTu7JeScnDn5gZgqb8ffT+cklrz5fTWr9ATKU6S02likEWGJLLiTQVcas 0fu+Kr4MNHfTN6k1hnqp60huJk8NAue/IRU9tTL984xnOJduGwEt+UzJvcw3ex+XREek 6Igp/KEL90oP/O9NA+kCX/A0HHgKEEC8Wtfvk/OnPozUPXlbBRmXdTERcf5Rdv+ej6y9 jafZtpygokzFYy3UieJ+fY8QbiFFL6XW8J8BMRwmTPUVBKxS+QxJcSFOwWEmyZIwCwXd RDfg== X-Gm-Message-State: ALQs6tC7qwFAJ0whliOJ65UtJDWck51ssTj2LVqUkAKgpbVRy7qAtSIx GRZpa/X/k8MhYlCIzwOIf7gg0O9ujQI= 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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(-) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;