linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFC: microread: use kfree_skb() instead of kfree()
@ 2013-03-21  7:40 Wei Yongjun
  2013-03-21 11:37 ` [linux-nfc] " Rymarkiewicz Waldemar
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Yongjun @ 2013-03-21  7:40 UTC (permalink / raw)
  To: lauro.venancio, aloisio.almeida, sameo
  Cc: yongjun_wei, linux-wireless, linux-nfc

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Use kfree_skb() instead of kfree() to free sk_buff.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/nfc/microread/mei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
index eef38cf..da8264c 100644
--- a/drivers/nfc/microread/mei.c
+++ b/drivers/nfc/microread/mei.c
@@ -130,7 +130,7 @@ static void microread_event_cb(struct mei_device *device, u32 events,
 
 		reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ);
 		if (reply_size < MEI_NFC_HEADER_SIZE) {
-			kfree(skb);
+			kfree_skb(skb);
 			return;
 		}
 


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

* Re: [linux-nfc] [PATCH] NFC: microread: use kfree_skb() instead of kfree()
  2013-03-21  7:40 [PATCH] NFC: microread: use kfree_skb() instead of kfree() Wei Yongjun
@ 2013-03-21 11:37 ` Rymarkiewicz Waldemar
  2013-03-21 13:57   ` Wei Yongjun
  0 siblings, 1 reply; 5+ messages in thread
From: Rymarkiewicz Waldemar @ 2013-03-21 11:37 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: lauro.venancio, aloisio.almeida, sameo, yongjun_wei,
	linux-wireless, linux-nfc

Hi,

> Use kfree_skb() instead of kfree() to free sk_buff.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>   drivers/nfc/microread/mei.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
> index eef38cf..da8264c 100644
> --- a/drivers/nfc/microread/mei.c
> +++ b/drivers/nfc/microread/mei.c
> @@ -130,7 +130,7 @@ static void microread_event_cb(struct mei_device *device, u32 events,
>
>   		reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ);
>   		if (reply_size < MEI_NFC_HEADER_SIZE) {
> -			kfree(skb);
> +			kfree_skb(skb);
>   			return;
>   		}

kfree_skb call is used internally by the kernel. A driver should use 
dev_kfree_skb instead, I guess.

Thanks,
/Waldek

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

* Re: [linux-nfc] [PATCH] NFC: microread: use kfree_skb() instead of kfree()
  2013-03-21 11:37 ` [linux-nfc] " Rymarkiewicz Waldemar
@ 2013-03-21 13:57   ` Wei Yongjun
  2013-03-22 10:38     ` Rymarkiewicz Waldemar
  0 siblings, 1 reply; 5+ messages in thread
From: Wei Yongjun @ 2013-03-21 13:57 UTC (permalink / raw)
  To: waldemar.rymarkiewicz
  Cc: lauro.venancio, aloisio.almeida, sameo, yongjun_wei,
	linux-wireless, linux-nfc

On 03/21/2013 07:37 PM, Rymarkiewicz Waldemar wrote:
> Hi,
>
>> Use kfree_skb() instead of kfree() to free sk_buff.
>>
>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> ---
>>   drivers/nfc/microread/mei.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
>> index eef38cf..da8264c 100644
>> --- a/drivers/nfc/microread/mei.c
>> +++ b/drivers/nfc/microread/mei.c
>> @@ -130,7 +130,7 @@ static void microread_event_cb(struct mei_device *device, u32 events,
>>
>>           reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ);
>>           if (reply_size < MEI_NFC_HEADER_SIZE) {
>> -            kfree(skb);
>> +            kfree_skb(skb);
>>               return;
>>           }
>
> kfree_skb call is used internally by the kernel. A driver should use dev_kfree_skb instead, I guess.

It seems that dev_kfree_skb() call when dev_alloc_skb() is used, and
kfree_skb() use to free skb malloced by alloc_skb().

Regards,
Yongjun Wei 



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

* Re: [linux-nfc] [PATCH] NFC: microread: use kfree_skb() instead of kfree()
  2013-03-21 13:57   ` Wei Yongjun
@ 2013-03-22 10:38     ` Rymarkiewicz Waldemar
  2013-03-28 11:23       ` Samuel Ortiz
  0 siblings, 1 reply; 5+ messages in thread
From: Rymarkiewicz Waldemar @ 2013-03-22 10:38 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: lauro.venancio, aloisio.almeida, sameo, yongjun_wei,
	linux-wireless, linux-nfc

Hi,

>>
>> kfree_skb call is used internally by the kernel. A driver should use dev_kfree_skb instead, I guess.
>
> It seems that dev_kfree_skb() call when dev_alloc_skb() is used, and
> kfree_skb() use to free skb malloced by alloc_skb().

I agree. The driver should use  dev_* flavoured skb function then.


Thanks,
/Waldek



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

* Re: [linux-nfc] [PATCH] NFC: microread: use kfree_skb() instead of kfree()
  2013-03-22 10:38     ` Rymarkiewicz Waldemar
@ 2013-03-28 11:23       ` Samuel Ortiz
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2013-03-28 11:23 UTC (permalink / raw)
  To: Rymarkiewicz Waldemar
  Cc: Wei Yongjun, lauro.venancio, aloisio.almeida, yongjun_wei,
	linux-wireless, linux-nfc

Hi Waldemar,

On Fri, Mar 22, 2013 at 11:38:57AM +0100, Rymarkiewicz Waldemar wrote:
> Hi,
> 
> >>
> >>kfree_skb call is used internally by the kernel. A driver should use dev_kfree_skb instead, I guess.
> >
> >It seems that dev_kfree_skb() call when dev_alloc_skb() is used, and
> >kfree_skb() use to free skb malloced by alloc_skb().
> 
> I agree. The driver should use  dev_* flavoured skb function then.
I'd prefer the driver to call nfc_alloc_recv_skb() instead. This one calls
alloc_skb() but we could have it call dev_alloc_skb() I suppose. dev_alloc_skb
does atomic allocation though.
And kfree_skb() or dev_kfree_skb() is essentially the same.

I'll fix the driver so that it calls nfc_alloc_recv_skb() and kfree_skb unless
Wei beats me at it.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2013-03-28 11:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-21  7:40 [PATCH] NFC: microread: use kfree_skb() instead of kfree() Wei Yongjun
2013-03-21 11:37 ` [linux-nfc] " Rymarkiewicz Waldemar
2013-03-21 13:57   ` Wei Yongjun
2013-03-22 10:38     ` Rymarkiewicz Waldemar
2013-03-28 11:23       ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).