mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ath6kl: Use vmalloc for loading firmware using api1 method
@ 2015-10-16  5:10 Brent Taylor
  2015-11-28 18:58 ` Brent Taylor
  2015-11-29  5:13 ` [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree Brent Taylor
  0 siblings, 2 replies; 10+ messages in thread
From: Brent Taylor @ 2015-10-16  5:10 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, netdev, linux-kernel, ath6kl, motobud

Signed-off-by: Brent Taylor <motobud@gmail.com>
---
 drivers/net/wireless/ath/ath6kl/init.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 6e473fa..2155739 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -673,10 +673,17 @@ 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 (*fw == NULL)
-		ret = -ENOMEM;
+	if (&ar->fw == fw) {
+		*fw = vmalloc(fw_entry->size);
+		if (*fw == NULL)
+			ret = -ENOMEM;
+		else
+			memcpy(*fw, fw_entry->data, fw_entry->size);
+	} else {
+		*fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
+		if (*fw == NULL)
+			ret = -ENOMEM;
+	}
 
 	release_firmware(fw_entry);
 
-- 
2.6.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ath6kl: Use vmalloc for loading firmware using api1 method
  2015-10-16  5:10 [PATCH] ath6kl: Use vmalloc for loading firmware using api1 method Brent Taylor
@ 2015-11-28 18:58 ` Brent Taylor
  2015-11-29  0:53   ` Andy Shevchenko
  2015-11-29  5:13 ` [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree Brent Taylor
  1 sibling, 1 reply; 10+ messages in thread
From: Brent Taylor @ 2015-11-28 18:58 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, netdev, linux-kernel, ath6kl

Sorry, the first e-mail was sent via gmail and I forgot about sending
it in plain text mode.

Whats the status on this patch?  I don't see it on patchwork anymore
nor is it in any of the git trees I checked.

Thanks,
Brent

On Fri, Oct 16, 2015 at 12:10 AM, Brent Taylor <motobud@gmail.com> wrote:
> Signed-off-by: Brent Taylor <motobud@gmail.com>
> ---
>  drivers/net/wireless/ath/ath6kl/init.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
> index 6e473fa..2155739 100644
> --- a/drivers/net/wireless/ath/ath6kl/init.c
> +++ b/drivers/net/wireless/ath/ath6kl/init.c
> @@ -673,10 +673,17 @@ 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 (*fw == NULL)
> -               ret = -ENOMEM;
> +       if (&ar->fw == fw) {
> +               *fw = vmalloc(fw_entry->size);
> +               if (*fw == NULL)
> +                       ret = -ENOMEM;
> +               else
> +                       memcpy(*fw, fw_entry->data, fw_entry->size);
> +       } else {
> +               *fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
> +               if (*fw == NULL)
> +                       ret = -ENOMEM;
> +       }
>
>         release_firmware(fw_entry);
>
> --
> 2.6.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ath6kl: Use vmalloc for loading firmware using api1 method
  2015-11-28 18:58 ` Brent Taylor
@ 2015-11-29  0:53   ` Andy Shevchenko
  2015-11-29  2:56     ` Tetsuo Handa
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2015-11-29  0:53 UTC (permalink / raw)
  To: Brent Taylor; +Cc: Kalle Valo, linux-wireless, netdev, linux-kernel, ath6kl

On Sat, Nov 28, 2015 at 8:58 PM, Brent Taylor <motobud@gmail.com> wrote:
> Sorry, the first e-mail was sent via gmail and I forgot about sending
> it in plain text mode.
>
> Whats the status on this patch?  I don't see it on patchwork anymore
> nor is it in any of the git trees I checked.
>

You forget to use kvfree() instead of kfree() in core.c.

> Thanks,
> Brent
>
> On Fri, Oct 16, 2015 at 12:10 AM, Brent Taylor <motobud@gmail.com> wrote:
>> Signed-off-by: Brent Taylor <motobud@gmail.com>
>> ---
>>  drivers/net/wireless/ath/ath6kl/init.c | 15 +++++++++++----
>>  1 file changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
>> index 6e473fa..2155739 100644
>> --- a/drivers/net/wireless/ath/ath6kl/init.c
>> +++ b/drivers/net/wireless/ath/ath6kl/init.c
>> @@ -673,10 +673,17 @@ 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 (*fw == NULL)
>> -               ret = -ENOMEM;
>> +       if (&ar->fw == fw) {
>> +               *fw = vmalloc(fw_entry->size);
>> +               if (*fw == NULL)
>> +                       ret = -ENOMEM;
>> +               else
>> +                       memcpy(*fw, fw_entry->data, fw_entry->size);
>> +       } else {
>> +               *fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
>> +               if (*fw == NULL)
>> +                       ret = -ENOMEM;
>> +       }
>>
>>         release_firmware(fw_entry);
>>
>> --
>> 2.6.1
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ath6kl: Use vmalloc for loading firmware using api1 method
  2015-11-29  0:53   ` Andy Shevchenko
@ 2015-11-29  2:56     ` Tetsuo Handa
  0 siblings, 0 replies; 10+ messages in thread
From: Tetsuo Handa @ 2015-11-29  2:56 UTC (permalink / raw)
  To: andy.shevchenko, motobud
  Cc: kvalo, linux-wireless, netdev, linux-kernel, ath6kl

Andy Shevchenko wrote:
> On Sat, Nov 28, 2015 at 8:58 PM, Brent Taylor <motobud@gmail.com> wrote:
> > Whats the status on this patch?  I don't see it on patchwork anymore
> > nor is it in any of the git trees I checked.
> >
> 
> You forget to use kvfree() instead of kfree() in core.c.
> 

In addition to that, I think you can do like below.

	if (&ar->fw == fw)
		*fw = vmalloc(fw_entry->size);
	else
		*fw = kmalloc(fw_entry->size, GFP_KERNEL);
	if (*fw == NULL)
		ret = -ENOMEM;
	else
		memcpy(*fw, fw_entry->data, fw_entry->size);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree
  2015-10-16  5:10 [PATCH] ath6kl: Use vmalloc for loading firmware using api1 method Brent Taylor
  2015-11-28 18:58 ` Brent Taylor
@ 2015-11-29  5:13 ` Brent Taylor
  2015-11-29  5:27   ` kbuild test robot
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Brent Taylor @ 2015-11-29  5:13 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, netdev, linux-kernel, ath6kl, Brent Taylor

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(-)

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);
 
-- 
2.6.3


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree
  2015-11-29  5:13 ` [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree Brent Taylor
@ 2015-11-29  5:27   ` kbuild test robot
  2015-11-29  5:51   ` [PATCH v3] " Brent Taylor
  2015-11-30  8:48   ` [PATCH v2] " Kalle Valo
  2 siblings, 0 replies; 10+ messages in thread
From: kbuild test robot @ 2015-11-29  5:27 UTC (permalink / raw)
  To: Brent Taylor
  Cc: kbuild-all, kvalo, linux-wireless, netdev, linux-kernel, ath6kl,
	Brent Taylor

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 23835 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree
  2015-11-29  5:13 ` [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree Brent Taylor
  2015-11-29  5:27   ` kbuild test robot
@ 2015-11-29  5:51   ` Brent Taylor
  2015-11-30  8:48     ` Kalle Valo
  2015-11-30  8:48   ` [PATCH v2] " Kalle Valo
  2 siblings, 1 reply; 10+ messages in thread
From: Brent Taylor @ 2015-11-29  5:51 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, netdev, linux-kernel, ath6kl, Brent Taylor

Signed-off-by: Brent Taylor <motobud@gmail.com>

ath6kl: Use vmalloc for loading firmware using api1 method and free using kvfree

ath6kl: fix kmalloc build error
---
Changes v2 -> v3:
   - fix kmalloc build error

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(-)

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..19535dc 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, GFP_KERNEL);
 
 	if (*fw == NULL)
 		ret = -ENOMEM;
+	else
+		memcpy(*fw, fw_entry->data, fw_entry->size);
 
 	release_firmware(fw_entry);
 
-- 
2.6.3


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree
  2015-11-29  5:13 ` [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree Brent Taylor
  2015-11-29  5:27   ` kbuild test robot
  2015-11-29  5:51   ` [PATCH v3] " Brent Taylor
@ 2015-11-30  8:48   ` Kalle Valo
  2015-11-30  9:05     ` Kalle Valo
  2 siblings, 1 reply; 10+ messages in thread
From: Kalle Valo @ 2015-11-30  8:48 UTC (permalink / raw)
  To: Brent Taylor; +Cc: linux-wireless, netdev, linux-kernel, ath6kl

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree
  2015-11-29  5:51   ` [PATCH v3] " Brent Taylor
@ 2015-11-30  8:48     ` Kalle Valo
  0 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2015-11-30  8:48 UTC (permalink / raw)
  To: Brent Taylor; +Cc: netdev, ath6kl, linux-wireless, linux-kernel

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
>
> ath6kl: fix kmalloc build error
> ---
> Changes v2 -> v3:
>    - fix kmalloc build error
>
> Changes v1 -> v2:
>    - simplify memory allocation
>    - use kvfree

The commit log in v3 is even worse.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree
  2015-11-30  8:48   ` [PATCH v2] " Kalle Valo
@ 2015-11-30  9:05     ` Kalle Valo
  0 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2015-11-30  9:05 UTC (permalink / raw)
  To: Brent Taylor; +Cc: linux-wireless, netdev, linux-kernel, ath6kl

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)

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-11-30  9:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16  5:10 [PATCH] ath6kl: Use vmalloc for loading firmware using api1 method Brent Taylor
2015-11-28 18:58 ` Brent Taylor
2015-11-29  0:53   ` Andy Shevchenko
2015-11-29  2:56     ` Tetsuo Handa
2015-11-29  5:13 ` [PATCH v2] ath6kl: Use vmalloc for loading firmware using api1 method and use kvfree Brent Taylor
2015-11-29  5:27   ` kbuild test robot
2015-11-29  5:51   ` [PATCH v3] " Brent Taylor
2015-11-30  8:48     ` Kalle Valo
2015-11-30  8:48   ` [PATCH v2] " Kalle Valo
2015-11-30  9:05     ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome