]> git.baikalelectronics.ru Git - kernel.git/commit
staging: r8188eu: use sizeof(*pvar) for allocating structs
authorRebecca Mckeever <remckee0@gmail.com>
Thu, 31 Mar 2022 17:16:04 +0000 (12:16 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Apr 2022 05:33:49 +0000 (07:33 +0200)
commitcc006644a60f67535bd6736721e5cbcebd416cf0
tree12ebc1cdf87201a35ccc03a772c65155666f6769
parent469805be5365a2eac0ad77e2e434da194424b468
staging: r8188eu: use sizeof(*pvar) for allocating structs

Use sizeof(*pvar) instead of sizeof(struct var) when allocating memory.
This conforms to Linux kernel coding style, improves readability,
and decreases the opportunity for bugs if the pointer variable type is
changed. Issue found by checkpatch messages of the following format:

CHECK: Prefer kzalloc(sizeof(*pvar)...) over kzalloc(sizeof(struct var)...)

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/YkXh1HBqaHwT38UC@bertie
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme.c
drivers/staging/r8188eu/core/rtw_mlme_ext.c