From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFC431DDC1B for ; Sun, 21 Jun 2026 13:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782048836; cv=none; b=JOyFrh9xfAhiOJ+/yS3FySRlfim+lCVZiy9mBFUTcSE6L2GgH9cr0Qx7wDv5Fy1lZOP95EoOEOXvuBwDRXXqSB/Wo3+f8kuiNTF+SyGNk+/iwnVErrLmEYFVfTAiKfn8HQ6HKf5j4tnctY2xnFZgAlTycIFwW4uKFm84R/H/E9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782048836; c=relaxed/simple; bh=DtegwQ/lcIT7sDNklzF6t2vZq6M5y1/DsszHICIfGt0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gxQ8z0kNoHzJQhG3XpzTuEnocmttPjQ0fyXGm99UH2plBTRH5a11ATlNaufAS/7QnpxsxcrbOa2PTwyPAX696Y3vjMFKZp4Szx5jl1bF6lIEOhAcqD6aqZS4cYALx5bJ3qQ9KakSjRKqjZWhycf8iN/xRZtgZwuwJLQB5ajUbm4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E9Z0j7mb; arc=none smtp.client-ip=209.85.128.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E9Z0j7mb" Received: by mail-wm1-f66.google.com with SMTP id 5b1f17b1804b1-491609cdd8fso20424195e9.2 for ; Sun, 21 Jun 2026 06:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782048833; x=1782653633; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VBZqzqsvffj6NeLXb19hVFi5fifS6sZJ8/eNWZ3Rw5M=; b=E9Z0j7mbj4AAAPGe1WdNDSRRpZ2mKY1qwdRO+6FIiuceQtR5nsXgsMc50bsrVzK55i iueO719y2Zjr/m5AlFN9UkLvoRBveCGdgtiUXBTaJNUd1mZownDZaIEuIku/Nx6LNi56 u+tybuSMOB8d7EP/+9wdPlO70Hk/KFTbJtoMrdrBnXvwEKis0OC86snChCKcX0j8F2AS CDOG9ijta16xQkstWcO3umeq1aZI8YcKkGysHpspIPBjWMbm0tPSdOpge613I8YM2d93 bDRtXBlBv8e8cZGLMND9QH+8F69xkSWPQ1YRECj1z+GpIcgof8hqH33/HnLA5JWzfyx7 LUfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782048833; x=1782653633; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VBZqzqsvffj6NeLXb19hVFi5fifS6sZJ8/eNWZ3Rw5M=; b=Dn+jYH/tdv/kNhjZaCt3T3mO9CQs6O1+1oIfddKuZBdCLF82vU0LDG+4966C26Soss JjcTZEuBYczaQdA1izWyoaVTcHep/lbsS5wBDiO3hQlwvoC7ZEPPG8cFqKe+PIvvu5kf qGIsJPEBvucoxuYjIp93oyZ8ETZyoA9bJ74Beyc7cKY4ozt3TsijQKnVNRTSaZ8vwG9g Wq1kYUbqvMkHUN3ILEfswUme39N478P6APZwGV8pXg2jPhB0SEKUGvyeJsci7r5fpgzM tM6NhW1Cr2O411D1MPWATlV4PaMWRzOzWPlAJuSSFkDLZg7buFsLwlheRnNKrBFKiLBZ v63A== X-Forwarded-Encrypted: i=1; AFNElJ88ZPKo9V6I1fS/wuuX+CiR5C3lX81NliJL6FZOZPZIagR1c6HBzu1YlTpDI35+Q8n6hLKB7Q5epzTHvzU=@vger.kernel.org X-Gm-Message-State: AOJu0YyvrWf4MxcEdgUjFABnEMNZxxRDLOT316qBMxr9jeYItIOoF6cg XaPWwjInn1eg4kPsGGoLuh01Bi1449THWNhyjciMGUiX/DjreHvA9bBF X-Gm-Gg: AfdE7clIBrglgPz09d3YSc6jyLOW7htnlsdgFBUqGojO3Z/VoUii3fqYSfDykR1BNVr HFZn5AHBY9IdXrhKhTvtT0U1fVX5JQCaZVKipkzHyX9m2jWxa8b9d01hD7A/yq9W+P1oeFlwH1+ 5tmvU5467MI+slX2/MTeoj+B8MAxzzhSy5y2JzzasRKKRs7qt8UV0sIZ4/TLkFQFlIasmR8MJ/X B+I3WGQ/r+r8Ipk7D/Z0smzwpEwqkNFHlRV+VpcGDYgpySnhaKJW08/e9xXSNqjYJl1SS9I0lUs vK6jqACBe8s6z6dBsEyPj4Mcs2OsmO/Jz0CfgImU0tTsL6CvxDhTzbbBBUJBhGc0N3Q+K/fk4pK 9ztENa+a4divH5GEsuVHfm2WP5LXlUjCAVRDTwMUjv4eFX9kwbtb0ZEsPNP/Ktrn7p1vDtsM= X-Received: by 2002:a05:600c:1550:b0:490:e913:656a with SMTP id 5b1f17b1804b1-49240e6c72dmr173100305e9.27.1782048833106; Sun, 21 Jun 2026 06:33:53 -0700 (PDT) Received: from fedora ([212.253.214.17]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49240f054e3sm216544855e9.2.2026.06.21.06.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jun 2026 06:33:51 -0700 (PDT) From: Serhat Kumral To: gregkh@linuxfoundation.org Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Serhat Kumral Subject: [PATCH] staging: rtl8723bs: avoid duplicate size computation in rtw_spt_band_alloc Date: Sun, 21 Jun 2026 16:33:01 +0300 Message-ID: <20260621133301.13855-1-serhatkumral1@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Introduce a local variable to store the channel array size and reuse it for both the allocation and the bitrates pointer offset, replacing a redundant open-coded multiplication with the same array_size() result. Resolves the Coccinelle warning: WARNING: array_size is already used (line 124) to compute the same size Signed-off-by: Serhat Kumral --- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 1484336d7..2e65788ee 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -111,7 +111,7 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( { struct ieee80211_supported_band *spt_band = NULL; int n_channels, n_bitrates; - size_t alloc_sz; + size_t alloc_sz, channels_sz; if (band == NL80211_BAND_2GHZ) { n_channels = RTW_2G_CHANNELS_NUM; @@ -120,15 +120,16 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( goto exit; } + channels_sz = array_size(n_channels, sizeof(struct ieee80211_channel)); alloc_sz = sizeof(*spt_band); - alloc_sz = size_add(alloc_sz, array_size(n_channels, sizeof(struct ieee80211_channel))); + alloc_sz = size_add(alloc_sz, channels_sz); alloc_sz = size_add(alloc_sz, array_size(n_bitrates, sizeof(struct ieee80211_rate))); spt_band = kzalloc(alloc_sz, GFP_KERNEL); if (!spt_band) goto exit; spt_band->channels = (struct ieee80211_channel *)(((u8 *)spt_band) + sizeof(struct ieee80211_supported_band)); - spt_band->bitrates = (struct ieee80211_rate *)(((u8 *)spt_band->channels) + sizeof(struct ieee80211_channel) * n_channels); + spt_band->bitrates = (struct ieee80211_rate *)(((u8 *)spt_band->channels) + channels_sz); spt_band->band = band; spt_band->n_channels = n_channels; spt_band->n_bitrates = n_bitrates; -- 2.54.0