Commit c1da5a7b authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman
Browse files

staging: r888eu: use dynamic allocation for efuse buffer



Use kmalloc to allocate the efuse buffer in ReadAdapterInfo8188EU and
free it on exit. This is better than using a 512 byte array on the stack.

It's ok to drop the __aligned(4) qualifier. kmalloc aligns to
ARCH_KMALLOC_MINALIGN, this is at least 8 bytes.

Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Suggested-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Acked-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220713075804.140986-1-martin@kaiser.cx


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4cdb845d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -927,7 +927,7 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter)
{
	struct eeprom_priv *eeprom = &Adapter->eeprompriv;
	struct led_priv *ledpriv = &Adapter->ledpriv;
	u8 efuse_buf[EFUSE_MAP_LEN_88E] __aligned(4);
	u8 *efuse_buf;
	u8 eeValue;
	int res;

@@ -938,7 +938,10 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter)

	eeprom->bautoload_fail_flag	= !(eeValue & EEPROM_EN);

	memset(efuse_buf, 0xFF, sizeof(efuse_buf));
	efuse_buf = kmalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL);
	if (!efuse_buf)
		return;
	memset(efuse_buf, 0xFF, EFUSE_MAP_LEN_88E);

	if (!(eeValue & BOOT_FROM_EEPROM) && !eeprom->bautoload_fail_flag) {
		rtl8188e_EfusePowerSwitch(Adapter, true);
@@ -958,6 +961,7 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter)
	Hal_ReadThermalMeter_88E(Adapter, efuse_buf, eeprom->bautoload_fail_flag);

	ledpriv->bRegUseLed = true;
	kfree(efuse_buf);
}

static void ResumeTxBeacon(struct adapter *adapt)