1
0
Fork 0

staging: rts5208: Assign array_size() to a variable

Assign array_size() to variable _size_ and use it in multiple places.

This issue was found with the help of Coccinelle and, audited and fixed
manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200710183350.GA8376@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
zero-sugar-mainline-defconfig
Gustavo A. R. Silva 2020-07-10 13:33:50 -05:00 committed by Greg Kroah-Hartman
parent cb22ab20c9
commit 8ffe5f36d7
1 changed files with 6 additions and 6 deletions

View File

@ -1440,6 +1440,7 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,
u16 aligned_addr = addr - offset;
int dw_len, i, j;
int retval;
size_t size;
if (!buf)
return STATUS_NOMEM;
@ -1451,11 +1452,12 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,
dev_dbg(rtsx_dev(chip), "dw_len = %d\n", dw_len);
data = vzalloc(array_size(dw_len, 4));
size = array_size(dw_len, 4);
data = vzalloc(size);
if (!data)
return STATUS_NOMEM;
mask = vzalloc(array_size(dw_len, 4));
mask = vzalloc(size);
if (!mask) {
vfree(data);
return STATUS_NOMEM;
@ -1471,10 +1473,8 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,
}
}
print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, mask,
dw_len * 4);
print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, data,
dw_len * 4);
print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, mask, size);
print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, data, size);
for (i = 0; i < dw_len; i++) {
retval = rtsx_write_cfg_dw(chip, func, aligned_addr + i * 4,