From patchwork Tue Sep 20 03:26:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Martynov X-Patchwork-Id: 9340953 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.web.codeaurora.org (Postfix) with ESMTP id 20D886077A for ; Tue, 20 Sep 2016 03:29:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1202E29BEF for ; Tue, 20 Sep 2016 03:29:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0625929BF3; Tue, 20 Sep 2016 03:29:44 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF8EE29BEF for ; Tue, 20 Sep 2016 03:29:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmBjy-0003fN-BE; Tue, 20 Sep 2016 03:29:02 +0000 Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmBjv-0003eR-Mk for ath10k@lists.infradead.org; Tue, 20 Sep 2016 03:29:00 +0000 Received: by mail-io0-x244.google.com with SMTP id y139so472558ioy.1 for ; Mon, 19 Sep 2016 20:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=YLF0VPhfPZj1hk7//w+sxwhUJAi9EnqQpp2X2i3MOvA=; b=veDcIGwGTSipdTB08d+yaGW/67wDr3uIb9HZpSlZ8uTv8u2QdvRi6ZurjfiaED1Dtz L7Ko2vFyeo9r0KY8A/l9fpR1xDGZ3KKH5MT+yfZw9aClkNVLljKzO5LHPGNaoZncIlG1 KNLJu71BmY+3CR9YOC8F+ZHWMbwoiAH8HQz6C7FeuSeKeVPqk2sdmHouFJoyfgDYgOgN mL1HiyYfSRa3BWGCwMmhwI2tVQ4SKw3PK4TFLGDaUoIhqHY4XaAizQGjA9Zy6t68HKku gqo+yvlHo6WDCi8L64ulMHdaaWxQBkC2LUU9XblJq1OwopnKWIMoRFJT4MDUv8RrR4xX 8+yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YLF0VPhfPZj1hk7//w+sxwhUJAi9EnqQpp2X2i3MOvA=; b=Uwa4xlTQGNpbCLw4Q0t6liS//zjecZKvnkS1/Zjv77WY61gBzqa4U+pTnE+3ci1srY 0MhxYz4a9jM0jjwDdFb4u32O/kHAFAh6tzP5zV0Q9XpU4qYCAqFthsp+MN751YxK6DBZ lqyDzt5K+OD3lxz2nrg7XGaGoQeJ8INa6/yYJ8hU5hXWws7aiwnNVIpIaQsrSroN20fB XS+JF30oe0A1Ya4C6PRJZXailG/orNLl/H22ftQSsmwE9eDvgohrVOym0RMICt9vim/l J1p2I4jJC2TytN/x8TFSZ73JMf2Di+snUPap+rA0fedjAzhxaHli7ersWsR2DuwPwawv BZMQ== X-Gm-Message-State: AE9vXwMnmoj8z2X67BH7AewcOz2UpSazcTaavLsRr7Aex76oeSxMTfdy5XdB6ui5Y5HdiA== X-Received: by 10.107.11.101 with SMTP id v98mr42050069ioi.145.1474342118589; Mon, 19 Sep 2016 20:28:38 -0700 (PDT) Received: from kolya-laptop.lan ([2600:16f6:caab:6a21::9d5]) by smtp.gmail.com with ESMTPSA id 8sm9406183itm.0.2016.09.19.20.28.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Sep 2016 20:28:38 -0700 (PDT) From: Nikolay Martynov To: kvalo@qca.qualcomm.com Subject: [PATCH] ath10k: fix debug cal data file Date: Mon, 19 Sep 2016 23:26:24 -0400 Message-Id: <1474341984-19220-1-git-send-email-mar.kolya@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160919_202859_843369_8D3EFE22 X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nikolay Martynov , linux-wireless@vger.kernel.org, ath10k@lists.infradead.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP It got broken by 0b8e3c4ca29fe2c0efd3d41a76e34a657b9f17a4 Signed-off-by: Nikolay Martynov --- drivers/net/wireless/ath/ath10k/debug.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 8f0fd41..7e82947 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -109,6 +109,11 @@ struct ath10k_dump_file_data { u8 data[0]; } __packed; +struct ath10k_debug_cal_data { + u32 len; + u8 buf[0]; +}; + void ath10k_info(struct ath10k *ar, const char *fmt, ...) { struct va_format vaf = { @@ -1453,7 +1458,8 @@ static const struct file_operations fops_fw_dbglog = { static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file) { struct ath10k *ar = inode->i_private; - void *buf; + struct ath10k_debug_cal_data *data; + u32 len; u32 hi_addr; __le32 addr; int ret; @@ -1466,12 +1472,15 @@ static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file) goto err; } - buf = vmalloc(ar->hw_params.cal_data_len); - if (!buf) { + len = ar->hw_params.cal_data_len; + data = vmalloc(sizeof(struct ath10k_debug_cal_data) + len); + if (!data) { ret = -ENOMEM; goto err; } + data->len = len; + hi_addr = host_interest_item_address(HI_ITEM(hi_board_data)); ret = ath10k_hif_diag_read(ar, hi_addr, &addr, sizeof(addr)); @@ -1480,21 +1489,20 @@ static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file) goto err_vfree; } - ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), buf, - ar->hw_params.cal_data_len); + ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), data->buf, len); if (ret) { ath10k_warn(ar, "failed to read calibration data: %d\n", ret); goto err_vfree; } - file->private_data = buf; + file->private_data = data; mutex_unlock(&ar->conf_mutex); return 0; err_vfree: - vfree(buf); + vfree(data); err: mutex_unlock(&ar->conf_mutex); @@ -1506,11 +1514,10 @@ static ssize_t ath10k_debug_cal_data_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { - struct ath10k *ar = file->private_data; - void *buf = file->private_data; + struct ath10k_debug_cal_data *data = file->private_data; return simple_read_from_buffer(user_buf, count, ppos, - buf, ar->hw_params.cal_data_len); + data->buf, data->len); } static int ath10k_debug_cal_data_release(struct inode *inode,