From patchwork Thu Feb 2 10:19:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 9551563 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 72C36604A7 for ; Thu, 2 Feb 2017 10:21:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7034E27FBE for ; Thu, 2 Feb 2017 10:21:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63ADC2839C; Thu, 2 Feb 2017 10:21:40 +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=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 EC40F27FBE for ; Thu, 2 Feb 2017 10:21:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cZEW3-0001qZ-Tn; Thu, 02 Feb 2017 10:21:23 +0000 Received: from mail-lf0-f53.google.com ([209.85.215.53]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cZEVy-0001lU-4y for ath10k@lists.infradead.org; Thu, 02 Feb 2017 10:21:20 +0000 Received: by mail-lf0-f53.google.com with SMTP id v186so5967901lfa.1 for ; Thu, 02 Feb 2017 02:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gJCid4sH+fpM49AJX86qGtnh/cuwFF16pcDwsYJMHaE=; b=rw5pVZtiWkeVlLtoT4MpJQ5JtcrlBotcnizqXjTcAGOVtZKaKhyeoUB4IzK4gylxZz eDjSeeJIkckXRcx6x2fi2EO3VzfX31dRfOJJ0lbutSC3HwBWzzcC2hrTi2QoOCcP2aGw 8HNwb3hpiqmuzmh201S/nQaBuNx3ocQ6BbvSs= 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=gJCid4sH+fpM49AJX86qGtnh/cuwFF16pcDwsYJMHaE=; b=JoLUtYdCxgvqO6WWgbds7cy5qNVdIjJvVtybqGtQdsqUrEBY1gdAdk+6cAZTLI88mB JVT+OO3Wti7kSdWuyibsGPQzexzkVM3O696AE/GbbktQeDeo0vffH1s/SYXI6A1frBkS bvsBedWxuEm81W4kPnbh5Nw8E8LE0C++ntDz7nDTYi0LZtDZ9T9tUqGfBje/x+8TM+7c yrlqIC2bSpUL+Jh+mJK63M5tHFGHHdvxp5ofGRE4OGhbhkHn34qpaKWfCITaA7bQ2kGn vRrMvR3IQn9hqHqaQhsqBXdYJRRIr6XYshupTqSUaOUbQRBgRQJbkL2Z6ub90Mzr/bwC HW4Q== X-Gm-Message-State: AIkVDXLGVws74q0TU9xjC4eFMS5m9JnKMy1bZwWIVqHE8GnfqekVjrCH3OiyUQrdVWSlwTpFzZ1EdA+BLQOkLYluZdHwMobC5NDNIwXsoinlFRedMQQPmlim4YYw3HnU2vdfoB4otC9MEhSnGaMgFGLmn0f/4GtcPnmLsxX7lgtD32UxnnRNnnkIcxASLp3qR74y6YJd X-Received: by 10.25.16.101 with SMTP id f98mr2283129lfi.120.1486030792021; Thu, 02 Feb 2017 02:19:52 -0800 (PST) Received: from uw001704.eu.tieto.com ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id 1sm2093298ljv.40.2017.02.02.02.19.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Feb 2017 02:19:51 -0800 (PST) From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= To: ath10k@lists.infradead.org, Kalle Valo Subject: [PATCH 2/3] ath10k: use size_t for len variables Date: Thu, 2 Feb 2017 11:19:32 +0100 Message-Id: <1486030773-30600-2-git-send-email-amadeusz.slawinski@tieto.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486030773-30600-1-git-send-email-amadeusz.slawinski@tieto.com> References: <1486030773-30600-1-git-send-email-amadeusz.slawinski@tieto.com> MIME-Version: 1.0 X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170202_022118_410588_45C0F7DE X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP cleanup to consolidate type used for len variables Signed-off-by: Amadeusz Sławiński --- drivers/net/wireless/ath/ath10k/core.c | 2 +- drivers/net/wireless/ath/ath10k/debug.c | 49 +++++++++++++++--------------- drivers/net/wireless/ath/ath10k/spectral.c | 7 +++-- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 749e381..2aa6bc7 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -349,7 +349,7 @@ void ath10k_core_get_fw_features_str(struct ath10k *ar, char *buf, size_t buf_len) { - unsigned int len = 0; + size_t len = 0; int i; for (i = 0; i < ATH10K_FW_FEATURE_COUNT; i++) { diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 82a4c67..f649236 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -235,7 +235,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file, { struct ath10k *ar = file->private_data; char *buf; - unsigned int len = 0, buf_len = 4096; + size_t len = 0, buf_len = 4096; const char *name; ssize_t ret_cnt; bool enabled; @@ -524,7 +524,7 @@ static ssize_t ath10k_fw_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { const char *buf = file->private_data; - unsigned int len = strlen(buf); + size_t len = strlen(buf); return simple_read_from_buffer(user_buf, count, ppos, buf, len); } @@ -542,17 +542,16 @@ static ssize_t ath10k_debug_fw_reset_stats_read(struct file *file, size_t count, loff_t *ppos) { struct ath10k *ar = file->private_data; - int ret, len, buf_len; + int ret; + size_t len = 0, buf_len = 500; char *buf; - buf_len = 500; buf = kmalloc(buf_len, GFP_KERNEL); if (!buf) return -ENOMEM; spin_lock_bh(&ar->data_lock); - len = 0; len += scnprintf(buf + len, buf_len - len, "fw_crash_counter\t\t%d\n", ar->stats.fw_crash_counter); len += scnprintf(buf + len, buf_len - len, @@ -691,7 +690,7 @@ static ssize_t ath10k_read_chip_id(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct ath10k *ar = file->private_data; - unsigned int len; + size_t len; char buf[50]; len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->chip_id); @@ -726,8 +725,8 @@ static struct ath10k_dump_file_data *ath10k_build_dump_file(struct ath10k *ar) struct ath10k_fw_crash_data *crash_data = ar->debug.fw_crash_data; struct ath10k_dump_file_data *dump_data; struct ath10k_tlv_dump_data *dump_tlv; - int hdr_len = sizeof(*dump_data); - unsigned int len, sofar = 0; + size_t hdr_len = sizeof(*dump_data); + size_t len, sofar = 0; unsigned char *buf; len = hdr_len; @@ -844,7 +843,7 @@ static ssize_t ath10k_reg_addr_read(struct file *file, { struct ath10k *ar = file->private_data; u8 buf[32]; - unsigned int len = 0; + size_t len = 0; u32 reg_addr; mutex_lock(&ar->conf_mutex); @@ -892,7 +891,7 @@ static ssize_t ath10k_reg_value_read(struct file *file, { struct ath10k *ar = file->private_data; u8 buf[48]; - unsigned int len; + size_t len; u32 reg_addr, reg_val; int ret; @@ -1115,7 +1114,7 @@ static ssize_t ath10k_read_htt_stats_mask(struct file *file, { struct ath10k *ar = file->private_data; char buf[32]; - unsigned int len; + size_t len; len = scnprintf(buf, sizeof(buf), "%lu\n", ar->debug.htt_stats_mask); @@ -1169,7 +1168,7 @@ static ssize_t ath10k_read_htt_max_amsdu_ampdu(struct file *file, struct ath10k *ar = file->private_data; char buf[64]; u8 amsdu, ampdu; - unsigned int len; + size_t len; mutex_lock(&ar->conf_mutex); @@ -1229,7 +1228,7 @@ static ssize_t ath10k_read_fw_dbglog(struct file *file, size_t count, loff_t *ppos) { struct ath10k *ar = file->private_data; - unsigned int len; + size_t len; char buf[96]; len = scnprintf(buf, sizeof(buf), "0x%16llx %u\n", @@ -1555,11 +1554,10 @@ static ssize_t ath10k_read_ani_enable(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct ath10k *ar = file->private_data; - int len = 0; + size_t len; char buf[32]; - len = scnprintf(buf, sizeof(buf) - len, "%d\n", - ar->ani_enabled); + len = scnprintf(buf, sizeof(buf), "%d\n", ar->ani_enabled); return simple_read_from_buffer(user_buf, count, ppos, buf, len); } @@ -1584,11 +1582,10 @@ static ssize_t ath10k_read_nf_cal_period(struct file *file, size_t count, loff_t *ppos) { struct ath10k *ar = file->private_data; - unsigned int len; + size_t len; char buf[32]; - len = scnprintf(buf, sizeof(buf), "%d\n", - ar->debug.nf_cal_period); + len = scnprintf(buf, sizeof(buf), "%d\n", ar->debug.nf_cal_period); return simple_read_from_buffer(user_buf, count, ppos, buf, len); } @@ -1684,9 +1681,10 @@ void ath10k_debug_tpc_stats_process(struct ath10k *ar, } static void ath10k_tpc_stats_print(struct ath10k_tpc_stats *tpc_stats, - unsigned int j, char *buf, unsigned int *len) + unsigned int j, char *buf, size_t *len) { - unsigned int i, buf_len; + int i; + size_t buf_len; static const char table_str[][5] = { "CDD", "STBC", "TXBF" }; @@ -1726,7 +1724,8 @@ static void ath10k_tpc_stats_fill(struct ath10k *ar, struct ath10k_tpc_stats *tpc_stats, char *buf) { - unsigned int len, j, buf_len; + int j; + size_t len, buf_len; len = 0; buf_len = ATH10K_TPC_CONFIG_BUF_SIZE; @@ -1860,7 +1859,7 @@ static ssize_t ath10k_tpc_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { const char *buf = file->private_data; - unsigned int len = strlen(buf); + size_t len = strlen(buf); return simple_read_from_buffer(user_buf, count, ppos, buf, len); } @@ -2284,7 +2283,7 @@ static ssize_t ath10k_debug_fw_checksums_read(struct file *file, size_t count, loff_t *ppos) { struct ath10k *ar = file->private_data; - unsigned int len = 0, buf_len = 4096; + size_t len = 0, buf_len = 4096; ssize_t ret_cnt; char *buf; @@ -2500,7 +2499,7 @@ void ath10k_dbg_dump(struct ath10k *ar, const void *buf, size_t len) { char linebuf[256]; - unsigned int linebuflen; + size_t linebuflen; const void *ptr; if (ath10k_debug_mask & mask) { diff --git a/drivers/net/wireless/ath/ath10k/spectral.c b/drivers/net/wireless/ath/ath10k/spectral.c index 2ffc1fe..c061d69 100644 --- a/drivers/net/wireless/ath/ath10k/spectral.c +++ b/drivers/net/wireless/ath/ath10k/spectral.c @@ -278,7 +278,7 @@ static ssize_t read_file_spec_scan_ctl(struct file *file, char __user *user_buf, { struct ath10k *ar = file->private_data; char *mode = ""; - unsigned int len; + size_t len; enum ath10k_spectral_mode spectral_mode; mutex_lock(&ar->conf_mutex); @@ -370,7 +370,7 @@ static ssize_t read_file_spectral_count(struct file *file, { struct ath10k *ar = file->private_data; char buf[32]; - unsigned int len; + size_t len; u8 spectral_count; mutex_lock(&ar->conf_mutex); @@ -422,7 +422,8 @@ static ssize_t read_file_spectral_bins(struct file *file, { struct ath10k *ar = file->private_data; char buf[32]; - unsigned int len, bins, fft_size, bin_scale; + unsigned int bins, fft_size, bin_scale; + size_t len; mutex_lock(&ar->conf_mutex);