linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8225se.c: Odd array size
@ 2017-11-28 16:49 Joe Perches
  2017-11-28 20:39 ` Larry Finger
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2017-11-28 16:49 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Larry.Finger, linux-wireless

61 entries in this table:

static const u8 OFDM_CONFIG[] = {
	0x10, 0x0F, 0x0A, 0x0C, 0x14, 0xFA, 0xFF, 0x50,
	0x00, 0x50, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00,
	0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xA8, 0x26,
	0x32, 0x33, 0x06, 0xA5, 0x6F, 0x55, 0xC8, 0xBB,
	0x0A, 0xE1, 0x2C, 0x4A, 0x86, 0x83, 0x34, 0x00,
	0x4F, 0x24, 0x6F, 0xC2, 0x03, 0x40, 0x80, 0x00,
	0xC0, 0xC1, 0x58, 0xF1, 0x00, 0xC4, 0x90, 0x3e,
	0xD8, 0x3C, 0x7B, 0x10, 0x10
};

but only 60 written?

static void rtl8187se_write_ofdm_config(struct ieee80211_hw *dev)
{
	/* write OFDM_CONFIG table */
	int i;

	for (i = 0; i < 60; i++)
		rtl8225se_write_phy_ofdm(dev, i, OFDM_CONFIG[i]);

}

This is the only use of OFDM_CONFIG.

What is the defect here?

Should 60 be ARRAY_SIZE(OFDM_CONFIG) or should the array be shortened?

One too many entries or one too few a write?
My guess would be one too few a write.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8225se.c: Odd array size
  2017-11-28 16:49 drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8225se.c: Odd array size Joe Perches
@ 2017-11-28 20:39 ` Larry Finger
  2017-11-28 20:50   ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Larry Finger @ 2017-11-28 20:39 UTC (permalink / raw)
  To: Joe Perches, Kalle Valo; +Cc: linux-wireless

On 11/28/2017 10:49 AM, Joe Perches wrote:
> 61 entries in this table:
> 
> static const u8 OFDM_CONFIG[] = {
> 	0x10, 0x0F, 0x0A, 0x0C, 0x14, 0xFA, 0xFF, 0x50,
> 	0x00, 0x50, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00,
> 	0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xA8, 0x26,
> 	0x32, 0x33, 0x06, 0xA5, 0x6F, 0x55, 0xC8, 0xBB,
> 	0x0A, 0xE1, 0x2C, 0x4A, 0x86, 0x83, 0x34, 0x00,
> 	0x4F, 0x24, 0x6F, 0xC2, 0x03, 0x40, 0x80, 0x00,
> 	0xC0, 0xC1, 0x58, 0xF1, 0x00, 0xC4, 0x90, 0x3e,
> 	0xD8, 0x3C, 0x7B, 0x10, 0x10
> };
> 
> but only 60 written?
> 
> static void rtl8187se_write_ofdm_config(struct ieee80211_hw *dev)
> {
> 	/* write OFDM_CONFIG table */
> 	int i;
> 
> 	for (i = 0; i < 60; i++)
> 		rtl8225se_write_phy_ofdm(dev, i, OFDM_CONFIG[i]);
> 
> }
> 
> This is the only use of OFDM_CONFIG.
> 
> What is the defect here?
> 
> Should 60 be ARRAY_SIZE(OFDM_CONFIG) or should the array be shortened?
> 
> One too many entries or one too few a write?
> My guess would be one too few a write.

Joe,

You are probably right; however, as I do not have this device and cannot test, 
the safer thing would be to crop the array back to 60 entries. That way the 
driver's behavior does not change.

I looked to see if rtl8187 had a similar construct, but it does not.

Larry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8225se.c: Odd array size
  2017-11-28 20:39 ` Larry Finger
@ 2017-11-28 20:50   ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2017-11-28 20:50 UTC (permalink / raw)
  To: Larry Finger, Kalle Valo, Andrea Merello; +Cc: linux-wireless

(adding the original submitter: Andrea Merello)

On Tue, 2017-11-28 at 14:39 -0600, Larry Finger wrote:
> On 11/28/2017 10:49 AM, Joe Perches wrote:
> > 61 entries in this table:
> > 
> > static const u8 OFDM_CONFIG[] = {
> > 	0x10, 0x0F, 0x0A, 0x0C, 0x14, 0xFA, 0xFF, 0x50,
> > 	0x00, 0x50, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00,
> > 	0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xA8, 0x26,
> > 	0x32, 0x33, 0x06, 0xA5, 0x6F, 0x55, 0xC8, 0xBB,
> > 	0x0A, 0xE1, 0x2C, 0x4A, 0x86, 0x83, 0x34, 0x00,
> > 	0x4F, 0x24, 0x6F, 0xC2, 0x03, 0x40, 0x80, 0x00,
> > 	0xC0, 0xC1, 0x58, 0xF1, 0x00, 0xC4, 0x90, 0x3e,
> > 	0xD8, 0x3C, 0x7B, 0x10, 0x10
> > };
> > 
> > but only 60 written?
> > 
> > static void rtl8187se_write_ofdm_config(struct ieee80211_hw *dev)
> > {
> > 	/* write OFDM_CONFIG table */
> > 	int i;
> > 
> > 	for (i = 0; i < 60; i++)
> > 		rtl8225se_write_phy_ofdm(dev, i, OFDM_CONFIG[i]);
> > 
> > }
> > 
> > This is the only use of OFDM_CONFIG.
> > 
> > What is the defect here?
> > 
> > Should 60 be ARRAY_SIZE(OFDM_CONFIG) or should the array be shortened?
> > 
> > One too many entries or one too few a write?
> > My guess would be one too few a write.
> 
> Joe,
> 
> You are probably right; however, as I do not have this device and cannot test, 
> the safer thing would be to crop the array back to 60 entries. That way the 
> driver's behavior does not change.

I'd guess the safest change would be adding a comment
and not making a code change at all.

cheers, Joe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-28 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 16:49 drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8225se.c: Odd array size Joe Perches
2017-11-28 20:39 ` Larry Finger
2017-11-28 20:50   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).