From patchwork Mon Jun 25 17:05:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Gross X-Patchwork-Id: 10486987 X-Patchwork-Delegate: agross@codeaurora.org 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 129C36023A for ; Mon, 25 Jun 2018 17:06:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06CCE28501 for ; Mon, 25 Jun 2018 17:06:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF3072857F; Mon, 25 Jun 2018 17:06:11 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ABC928501 for ; Mon, 25 Jun 2018 17:06:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934333AbeFYRGK (ORCPT ); Mon, 25 Jun 2018 13:06:10 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:43856 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933724AbeFYRGJ (ORCPT ); Mon, 25 Jun 2018 13:06:09 -0400 Received: by mail-ot0-f196.google.com with SMTP id i19-v6so15854193otk.10 for ; Mon, 25 Jun 2018 10:06:09 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=+ol+wIMDDYu7e+V4lYapWAJa5L3g/Qmnqf/iFLZIOIM=; b=ioKp+NLawQukvJIRNPAFBoJRd045XkfC82U9I9NPgY78EtRO0TnWXVAVNOxuYbpggL 9RIuU2rSg4xFCi2tYdaxMq/qjhGbp2i1C1aY1dGn8dtXd7wSrCm/kQ/NmWCUpqe4GkRg kunAfaIOK8Xnu5KQzqct4kWuvo9bXczOVSkmQ= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+ol+wIMDDYu7e+V4lYapWAJa5L3g/Qmnqf/iFLZIOIM=; b=iDxImDqpw9oaUBtKEALCSniWAf7QjT2NP9Z8V6uTwqDMhqaQznhy/fOchzB7Xovvds H3GS7Ak/x/kpdqVN3JZ4/DgUoMugbtHA6H7Xc/iHaLWLT4xL74XoBWTh6EdiKmES3Czv rBhJ4KgGYi+NBDHvPaqXXKEC0OLvBz74F83agQF8jfR85gYqRugr1ox5O4GeM+rLmaCV u+ovkBKrPJzui0RqIGNWlBX2i8KWOwAGSpmuVEyAkniv9zAQkGdD7jgqr55Q4bwqoIhr 16CdQEpwg8FwTwnEO7e1Q2icGW3sHkH5dM/bT5AcRsbyWvGh3Mb7Q7O5y02w9yHYua8f xjuw== X-Gm-Message-State: APt69E25L2bgP3gR/yxoqD0MzAnar4w/I6u1s7qT/Z2JnrYVONRoTio8 UGV9u109EKMuDUxuSeU0UEbIl0UdyyA= X-Google-Smtp-Source: ADUXVKIZ/v6aebewQ/Wx/WayLKpdnjlPoTqxaFW7DrtGcS6QfeHlmf6ANf1Bfqn0uIFogk3x2uBTyw== X-Received: by 2002:a9d:241:: with SMTP id 59-v6mr8543216otb.71.1529946368565; Mon, 25 Jun 2018 10:06:08 -0700 (PDT) Received: from localhost ([2600:1700:141:4960:88f5:ab30:e569:4ad6]) by smtp.gmail.com with ESMTPSA id t4-v6sm16740553otd.40.2018.06.25.10.06.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 10:06:08 -0700 (PDT) From: Andy Gross To: linux-arm-msm@vger.kernel.org Cc: Bjorn Andersson , mahesh sivasubramanian , Linus Torvalds , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Stephen Boyd , Andy Gross Subject: [PATCH 2/2] soc: qcom: cmd-db: Fix compiler warnings Date: Mon, 25 Jun 2018 12:05:47 -0500 Message-Id: <1529946347-12740-2-git-send-email-andy.gross@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529946347-12740-1-git-send-email-andy.gross@linaro.org> References: <1529946347-12740-1-git-send-email-andy.gross@linaro.org> 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 X-Virus-Scanned: ClamAV using ClamSMTP This patch adds initialization of the entry_header structs to avoid compiler warnings like the following: CC drivers/soc/qcom/cmd-db.o 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_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); 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] Signed-off-by: Andy Gross --- drivers/soc/qcom/cmd-db.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index deb2b90..1007e79 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,7 +207,7 @@ 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 entry_header ent = {}; struct rsc_hdr rsc_hdr; u16 ent_len; @@ -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;