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: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220713075804.140986-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Martin Kaiser 2022-07-13 09:58:04 +02:00 committed by Greg Kroah-Hartman
parent 4cdb845db3
commit c1da5a7bef

View File

@ -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)