diff mbox

[v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree

Message ID 1448774038-26984-1-git-send-email-motobud@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Brent Taylor Nov. 29, 2015, 5:13 a.m. UTC
Signed-off-by: Brent Taylor <motobud@gmail.com>

ath6kl: Use vmalloc for loading firmware using api1 method and free using kvfree
---
Changes v1 -> v2:
   - simplify memory allocation
   - use kvfree

 drivers/net/wireless/ath/ath6kl/core.c | 2 +-
 drivers/net/wireless/ath/ath6kl/init.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

kernel test robot Nov. 29, 2015, 5:27 a.m. UTC | #1
Hi Brent,

[auto build test ERROR on: net-next/master]
[also build test ERROR on: v4.4-rc2 next-20151127]

url:    https://github.com/0day-ci/linux/commits/Brent-Taylor/ath6kl-Use-vmalloc-for-loading-firmware-using-api1-method-and-use-kvfree/20151129-132013
config: x86_64-randconfig-x012-201548 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/net/wireless/ath/ath6kl/init.c: In function 'ath6kl_get_fw':
>> drivers/net/wireless/ath/ath6kl/init.c:679:9: error: too few arguments to function 'kmalloc'
      *fw = kmalloc(fw_entry->size);
            ^
   In file included from include/linux/textsearch.h:8:0,
                    from include/linux/skbuff.h:30,
                    from include/linux/if_ether.h:23,
                    from include/linux/etherdevice.h:25,
                    from drivers/net/wireless/ath/ath6kl/core.h:21,
                    from drivers/net/wireless/ath/ath6kl/init.c:28:
   include/linux/slab.h:428:30: note: declared here
    static __always_inline void *kmalloc(size_t size, gfp_t flags)
                                 ^

vim +/kmalloc +679 drivers/net/wireless/ath/ath6kl/init.c

   673			return ret;
   674	
   675		*fw_len = fw_entry->size;
   676		if (&ar->fw == fw)
   677			*fw = vmalloc(fw_entry->size);
   678		else
 > 679			*fw = kmalloc(fw_entry->size);
   680	
   681		if (*fw == NULL)
   682			ret = -ENOMEM;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Kalle Valo Nov. 30, 2015, 8:48 a.m. UTC | #2
Brent Taylor <motobud@gmail.com> writes:

> Signed-off-by: Brent Taylor <motobud@gmail.com>
>
> ath6kl: Use vmalloc for loading firmware using api1 method and free using kvfree
> ---
> Changes v1 -> v2:
>    - simplify memory allocation
>    - use kvfree

Why? The commit log should _always_ answer that. Are you fixing a bug
(what bug exactly?), is this just cleanup or what?

And the commit log is wrongly formatted anyway, the Signed-off-by line
should be the last and there should be no "ath6kl:" string in the commit
log (just in the title). Use 'git log' to find examples.
Kalle Valo Nov. 30, 2015, 9:05 a.m. UTC | #3
Kalle Valo <kvalo@qca.qualcomm.com> writes:

> Brent Taylor <motobud@gmail.com> writes:
>
>> Signed-off-by: Brent Taylor <motobud@gmail.com>
>>
>> ath6kl: Use vmalloc for loading firmware using api1 method and free using kvfree
>> ---
>> Changes v1 -> v2:
>>    - simplify memory allocation
>>    - use kvfree
>
> Why? The commit log should _always_ answer that. Are you fixing a bug
> (what bug exactly?), is this just cleanup or what?
>
> And the commit log is wrongly formatted anyway, the Signed-off-by line
> should be the last and there should be no "ath6kl:" string in the commit
> log (just in the title). Use 'git log' to find examples.

Fixing netdev address (kenrel -> kernel)
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c
index 4ec02ce..052e58b 100644
--- a/drivers/net/wireless/ath/ath6kl/core.c
+++ b/drivers/net/wireless/ath/ath6kl/core.c
@@ -343,7 +343,7 @@  void ath6kl_core_cleanup(struct ath6kl *ar)
 
 	kfree(ar->fw_board);
 	kfree(ar->fw_otp);
-	vfree(ar->fw);
+	kvfree(ar->fw);
 	kfree(ar->fw_patch);
 	kfree(ar->fw_testscript);
 
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 6e473fa..836afea2 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -673,10 +673,15 @@  static int ath6kl_get_fw(struct ath6kl *ar, const char *filename,
 		return ret;
 
 	*fw_len = fw_entry->size;
-	*fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
+	if (&ar->fw == fw)
+		*fw = vmalloc(fw_entry->size);
+	else
+		*fw = kmalloc(fw_entry->size);
 
 	if (*fw == NULL)
 		ret = -ENOMEM;
+	else
+		memcpy(*fw, fw_entry->data, fw_entry->size);
 
 	release_firmware(fw_entry);