[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d06ce4fa239645cc9de48c1062f58f14@AcuMS.aculab.com>
Date: Sun, 20 Mar 2022 18:46:46 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'trix@...hat.com'" <trix@...hat.com>,
"toke@...e.dk" <toke@...e.dk>,
"kvalo@...nel.org" <kvalo@...nel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>
CC: "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] ath9k: initialize arrays at compile time
From: trix@...hat.com <trix@...hat.com>
> Sent: 20 March 2022 15:20
>
> Early clearing of arrays with
> memset(array, 0, size);
> is equivilent to initializing the array in its decl with
> array[size] = { 0 };
>
> Since compile time is preferred over runtime,
> convert the memsets to initializations.
...
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
> b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
> index dc24da1ff00b1..39fcc158cb159 100644
> --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
> +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
> @@ -891,10 +891,9 @@ static void ar9003_hw_tx_iq_cal_outlier_detection(struct ath_hw *ah,
> {
> int i, im, nmeasurement;
> int magnitude, phase;
> - u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS];
> + u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS] = { 0 };
For a two dimensional array that needs to be {{0}} (or {}).
And, since there is only one definitions of 'coeff' it can
be static!
(Currently on 96 bytes - si not a real problem on-stack.)
Although I just failed to find the lock that stops
concurrent execution on multiple cpu.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists