From patchwork Tue May 7 06:58:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10932361 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56369924 for ; Tue, 7 May 2019 06:58:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4085D205D1 for ; Tue, 7 May 2019 06:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34CE52891B; Tue, 7 May 2019 06:58:43 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74C69205D1 for ; Tue, 7 May 2019 06:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ukIpsV2wyzMNuzFwuoRapf3K5jCEjyOlociC9N8Z9ps=; b=czx4lnma8XG7M4 KHdECqZJoIMMPHIra94AN9ycGHD38/TBgJZamV2R6Z13Ujmy0KX6aSoMzNPObUg+O+WS36jq9xHh/ TugdbV28Pm3ZdZajJjO6pp8RX/1813JrqzUi3X8bGelbFTeEwprQIhE1wIgSOku79O/2Z5CX5bVu8 KzfHX7BLLRKHNrLF6KtrDTswD9BOqYXiqLB03YburW4pjXkFyV9YLt6hGMlXv+EAfdtthsXt4/rPn C/1EbQsUhe5x03YI276w//8ziUiSQhI2tqYsZGiCyZl3PRxPfyJXADrP8kX20eX99ezfkD1cxTYXX 8TuHBsI0HCi7a23bHmtA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hNu3k-0003A8-8S; Tue, 07 May 2019 06:58:40 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hNu3h-00039K-QS for ath11k@lists.infradead.org; Tue, 07 May 2019 06:58:39 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8E90160850; Tue, 7 May 2019 06:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557212317; bh=6CP4nlUOpC6GY3jsqCed3r4ZgVZrnBTIxS6Lhmq0aS8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Jc4azGhJrBuOel5Zbr9vCxoKz7EIs+ibJoW2qRms6NnkqZ7gsXQetqC5GKRD4tkeV cdiB5+FZWYkjWGq2s6x3pu3nqkghEVI1e6xW7Mjv8pNUfmHWkEe+QoUuZYflds5Aay z0DbWFUJJ8mgV7mEVghLUHN+NrOZXXyn2NSMWbAY= Received: from localhost.localdomain (37-136-65-53.rev.dnainternet.fi [37.136.65.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6E5C960744 for ; Tue, 7 May 2019 06:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557212317; bh=6CP4nlUOpC6GY3jsqCed3r4ZgVZrnBTIxS6Lhmq0aS8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Jc4azGhJrBuOel5Zbr9vCxoKz7EIs+ibJoW2qRms6NnkqZ7gsXQetqC5GKRD4tkeV cdiB5+FZWYkjWGq2s6x3pu3nqkghEVI1e6xW7Mjv8pNUfmHWkEe+QoUuZYflds5Aay z0DbWFUJJ8mgV7mEVghLUHN+NrOZXXyn2NSMWbAY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6E5C960744 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: ath11k@lists.infradead.org Subject: [PATCH 2/2] ath11k: qmi: fix frame size warnings Date: Tue, 7 May 2019 09:58:32 +0300 Message-Id: <1557212312-11990-2-git-send-email-kvalo@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557212312-11990-1-git-send-email-kvalo@codeaurora.org> References: <1557212312-11990-1-git-send-email-kvalo@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190506_235837_890861_854E8A12 X-CRM114-Status: GOOD ( 12.25 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP GCC warned: drivers/net/wireless/ath/ath11k/qmi.c: In function 'ath11k_qmi_respond_fw_mem_request': drivers/net/wireless/ath/ath11k/qmi.c:1678:1: warning: the frame size of 1096 bytes is larger than 1024 bytes [-Wframe-larger-than=] drivers/net/wireless/ath/ath11k/qmi.c: In function 'ath11k_qmi_wlanfw_wlan_cfg_send': drivers/net/wireless/ath/ath11k/qmi.c:2094:1: warning: the frame size of 1136 bytes is larger than 1024 bytes [-Wframe-larger-than=] Fix that by allocating bigger structures dynamically. Compile tested only. Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/qmi.c | 67 ++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index aca717ca1955..b862fa93bba8 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -1624,37 +1624,40 @@ static int ath11k_qmi_fw_ind_register_send(struct ath11k_base *ab) static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base *ab) { - struct qmi_wlanfw_respond_mem_req_msg_v01 req; + struct qmi_wlanfw_respond_mem_req_msg_v01 *req; struct qmi_wlanfw_respond_mem_resp_msg_v01 resp; struct qmi_txn txn = {}; int ret = 0, i; - memset(&req, 0, sizeof(req)); + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return -ENOMEM; + memset(&resp, 0, sizeof(resp)); - req.mem_seg_len = ab->qmi.mem_seg_count; + req->mem_seg_len = ab->qmi.mem_seg_count; ret = qmi_txn_init(&ab->qmi.handle, &txn, qmi_wlanfw_respond_mem_resp_msg_v01_ei, &resp); if (ret < 0) goto out; - for (i = 0; i < req.mem_seg_len ; i++) { + for (i = 0; i < req->mem_seg_len ; i++) { if (!ab->qmi.target_mem[i].paddr || !ab->qmi.target_mem[i].size) { ath11k_warn(ab, "qmi invalid mem request for target\n"); ret = -EINVAL; goto out; } - req.mem_seg[i].addr = ab->qmi.target_mem[i].paddr; - req.mem_seg[i].size = ab->qmi.target_mem[i].size; - req.mem_seg[i].type = ab->qmi.target_mem[i].type; + req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr; + req->mem_seg[i].size = ab->qmi.target_mem[i].size; + req->mem_seg[i].type = ab->qmi.target_mem[i].type; } ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, QMI_WLANFW_RESPOND_MEM_REQ_V01, QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN, - qmi_wlanfw_respond_mem_req_msg_v01_ei, &req); + qmi_wlanfw_respond_mem_req_msg_v01_ei, req); if (ret < 0) { ath11k_warn(ab, "qmi failed to respond memory request, err = %d\n", ret); @@ -1674,6 +1677,7 @@ static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base *ab) goto out; } out: + kfree(req); return ret; } @@ -2021,7 +2025,7 @@ static int ath11k_qmi_wlanfw_mode_send(struct ath11k_base *ab, static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base *ab) { - struct qmi_wlanfw_wlan_cfg_req_msg_v01 req; + struct qmi_wlanfw_wlan_cfg_req_msg_v01 *req; struct qmi_wlanfw_wlan_cfg_resp_msg_v01 resp; struct ce_pipe_config *ce_cfg; struct service_to_pipe *svc_cfg; @@ -2030,36 +2034,40 @@ static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base *ab) ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; - memset(&req, 0, sizeof(req)); + + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return -ENOMEM; + memset(&resp, 0, sizeof(resp)); - req.host_version_valid = 1; - strlcpy(req.host_version, ATH11K_HOST_VERSION_STRING, - sizeof(req.host_version)); + req->host_version_valid = 1; + strlcpy(req->host_version, ATH11K_HOST_VERSION_STRING, + sizeof(req->host_version)); - req.tgt_cfg_valid = 1; + req->tgt_cfg_valid = 1; /* This is number of CE configs */ - req.tgt_cfg_len = ((ab->qmi.ce_cfg.tgt_ce_len) / + req->tgt_cfg_len = ((ab->qmi.ce_cfg.tgt_ce_len) / (sizeof(struct ce_pipe_config))) - 1; - for (ret = 0; ret <= req.tgt_cfg_len ; ret++) { - req.tgt_cfg[ret].pipe_num = ce_cfg[ret].pipenum; - req.tgt_cfg[ret].pipe_dir = ce_cfg[ret].pipedir; - req.tgt_cfg[ret].nentries = ce_cfg[ret].nentries; - req.tgt_cfg[ret].nbytes_max = ce_cfg[ret].nbytes_max; - req.tgt_cfg[ret].flags = ce_cfg[ret].flags; + for (ret = 0; ret <= req->tgt_cfg_len ; ret++) { + req->tgt_cfg[ret].pipe_num = ce_cfg[ret].pipenum; + req->tgt_cfg[ret].pipe_dir = ce_cfg[ret].pipedir; + req->tgt_cfg[ret].nentries = ce_cfg[ret].nentries; + req->tgt_cfg[ret].nbytes_max = ce_cfg[ret].nbytes_max; + req->tgt_cfg[ret].flags = ce_cfg[ret].flags; } - req.svc_cfg_valid = 1; + req->svc_cfg_valid = 1; /* This is number of Service/CE configs */ - req.svc_cfg_len = (ab->qmi.ce_cfg.svc_to_ce_map_len) / + req->svc_cfg_len = (ab->qmi.ce_cfg.svc_to_ce_map_len) / (sizeof(struct service_to_pipe)); - for (ret = 0; ret < req.svc_cfg_len; ret++) { - req.svc_cfg[ret].service_id = svc_cfg[ret].service_id; - req.svc_cfg[ret].pipe_dir = svc_cfg[ret].pipedir; - req.svc_cfg[ret].pipe_num = svc_cfg[ret].pipenum; + for (ret = 0; ret < req->svc_cfg_len; ret++) { + req->svc_cfg[ret].service_id = svc_cfg[ret].service_id; + req->svc_cfg[ret].pipe_dir = svc_cfg[ret].pipedir; + req->svc_cfg[ret].pipe_num = svc_cfg[ret].pipenum; } - req.shadow_reg_valid = 0; - req.shadow_reg_v2_valid = 0; + req->shadow_reg_valid = 0; + req->shadow_reg_v2_valid = 0; ret = qmi_txn_init(&ab->qmi.handle, &txn, qmi_wlanfw_wlan_cfg_resp_msg_v01_ei, &resp); @@ -2090,6 +2098,7 @@ static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base *ab) } out: + kfree(req); return ret; }