Messages in this thread | | | Date | Mon, 20 Aug 2018 12:35:46 +0300 | From | Dan Carpenter <> | Subject | Re: [PATCH] staging: rtl8188eu: Removed a function and coded inline |
| |
On Sun, Aug 19, 2018 at 12:36:40AM +0530, Bhaskar Singh wrote: > This patch removed function named rtw_malloc2d. > > I removed this function because this function is used exactly once and > function call have some overhead also. > > Maybe this will improve code runtime slightly. > > Signed-off-by: Bhaskar Singh <bhaskar.kernel@gmail.com> > --- > drivers/staging/rtl8188eu/core/rtw_efuse.c | 10 +++++++++- > drivers/staging/rtl8188eu/include/osdep_service.h | 2 -- > drivers/staging/rtl8188eu/os_dep/osdep_service.c | 14 -------------- > 3 files changed, 9 insertions(+), 17 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c > index 0fd306a808c4..befc99c197b1 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c > +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c > @@ -86,12 +86,20 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) > u16 **eFuseWord = NULL; > u16 efuse_utilized = 0; > u8 u1temp = 0; > + int z;
z is unusual name for an iterator. Does it stand for something? Just use "int i;".
> + void **a = NULL;
What does "a" mean in this context? Maybe just say "void **tmp;"
> > efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL); > if (!efuseTbl) > return; > > - eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); > + a = kzalloc(EFUSE_MAX_SECTION_88E * sizeof(void *) + EFUSE_MAX_SECTION_88E * EFUSE_MAX_WORD_UNIT * sizeof(u16), GFP_KERNEL); > + if (!a) > + goto out;
You can simplify the math a bit:
tmp = kzalloc(EFUSE_MAX_SECTION_88E * (sizeof(void *) + EFUSE_MAX_WORD_UNIT * sizeof(u16)), GFP_KERNEL);
Then if it fails:
if (!tmp) goto eFuseWord_failed;
regards, dan carpenter
| |