2015-11-08 07:09:30

by Ivan Safonov

[permalink] [raw]
Subject: [PATCH v2 05/12] staging: rtl8188eu: kzalloc replaced by kmalloc

_rtl88e_fill_dummy fills the array elemets with zeros if necessary.

Signed-off-by: Ivan Safonov <[email protected]>
---
drivers/staging/rtl8188eu/hal/fw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c
index 1d8930a..7f1df4d 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -189,7 +189,7 @@ int rtl88eu_download_fw(struct adapter *adapt)
return -EFBIG;
}

- pfwdata = kzalloc(FW_8188E_SIZE, GFP_KERNEL);
+ pfwdata = kmalloc(FW_8188E_SIZE, GFP_KERNEL);
if (!pfwdata)
return -ENOMEM;

--
2.4.10


2015-11-11 09:43:37

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v2 05/12] staging: rtl8188eu: kzalloc replaced by kmalloc

On Sun, Nov 08, 2015 at 02:11:08PM +0700, Ivan Safonov wrote:
> _rtl88e_fill_dummy fills the array elemets with zeros if necessary.
>

_rtl88e_fill_dummy() fills the last sizeof(u32) or whatever so the code
is aligned but it doesn't fill up to the end of FW_8188E_SIZE. Why do
we even allocate that much memory. Why don't we just allocate:

pfwdata = kmalloc(round_up(fwsize, sizeof(u32)), GFP_KERNEL);

regards,
dan carpenter

2015-11-11 10:16:08

by Ivan Safonov

[permalink] [raw]
Subject: Re: [PATCH v2 05/12] staging: rtl8188eu: kzalloc replaced by kmalloc

On 11/11/2015 04:43 PM, Dan Carpenter wrote:
> On Sun, Nov 08, 2015 at 02:11:08PM +0700, Ivan Safonov wrote:
>> _rtl88e_fill_dummy fills the array elemets with zeros if necessary.
>>
> _rtl88e_fill_dummy() fills the last sizeof(u32) or whatever so the code
> is aligned but it doesn't fill up to the end of FW_8188E_SIZE. Why do
> we even allocate that much memory. Why don't we just allocate:
>
> pfwdata = kmalloc(round_up(fwsize, sizeof(u32)), GFP_KERNEL);
>
> regards,
> dan carpenter

Yes, it will save about 2 KB. I will correct it in the next patch.