* [PATCH] staging: cxt1e1: use kzalloc instead of kmalloc/memset 0
@ 2014-03-05 2:37 Daeseok Youn
2014-03-05 10:04 ` Tobias Klauser
0 siblings, 1 reply; 3+ messages in thread
From: Daeseok Youn @ 2014-03-05 2:37 UTC (permalink / raw)
To: gregkh; +Cc: dulshani.gunawardhana89, sachin.kamat, devel, linux-kernel
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
drivers/staging/cxt1e1/sbecom_inline_linux.h | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/cxt1e1/sbecom_inline_linux.h b/drivers/staging/cxt1e1/sbecom_inline_linux.h
index ba3ff3e..6dd1b55 100644
--- a/drivers/staging/cxt1e1/sbecom_inline_linux.h
+++ b/drivers/staging/cxt1e1/sbecom_inline_linux.h
@@ -46,11 +46,9 @@ void pci_write_32 (u_int32_t *p, u_int32_t v);
static inline void *
OS_kmalloc (size_t size)
{
- char *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA);
+ char *ptr = kzalloc(size, GFP_KERNEL | GFP_DMA);
- if (ptr)
- memset (ptr, 0, size);
- return ptr;
+ return ptr;
}
static inline void
--
1.7.4.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: cxt1e1: use kzalloc instead of kmalloc/memset 0
2014-03-05 2:37 [PATCH] staging: cxt1e1: use kzalloc instead of kmalloc/memset 0 Daeseok Youn
@ 2014-03-05 10:04 ` Tobias Klauser
2014-03-06 7:02 ` DaeSeok Youn
0 siblings, 1 reply; 3+ messages in thread
From: Tobias Klauser @ 2014-03-05 10:04 UTC (permalink / raw)
To: Daeseok Youn
Cc: gregkh, sachin.kamat, devel, linux-kernel, dulshani.gunawardhana89
On 2014-03-05 at 03:37:15 +0100, Daeseok Youn <daeseok.youn@gmail.com> wrote:
>
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---
> drivers/staging/cxt1e1/sbecom_inline_linux.h | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/cxt1e1/sbecom_inline_linux.h b/drivers/staging/cxt1e1/sbecom_inline_linux.h
> index ba3ff3e..6dd1b55 100644
> --- a/drivers/staging/cxt1e1/sbecom_inline_linux.h
> +++ b/drivers/staging/cxt1e1/sbecom_inline_linux.h
> @@ -46,11 +46,9 @@ void pci_write_32 (u_int32_t *p, u_int32_t v);
> static inline void *
> OS_kmalloc (size_t size)
> {
> - char *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA);
> + char *ptr = kzalloc(size, GFP_KERNEL | GFP_DMA);
>
> - if (ptr)
> - memset (ptr, 0, size);
> - return ptr;
> + return ptr;
> }
It would probably be even better to get rid of this function altogether
and replace all calls to it by kmalloc/kzalloc.
>From a quick look at the users of OS_kmalloc, it also looks like GFP_DMA
isn't needed for all of them.
Cheers
Tobias
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: cxt1e1: use kzalloc instead of kmalloc/memset 0
2014-03-05 10:04 ` Tobias Klauser
@ 2014-03-06 7:02 ` DaeSeok Youn
0 siblings, 0 replies; 3+ messages in thread
From: DaeSeok Youn @ 2014-03-06 7:02 UTC (permalink / raw)
To: Tobias Klauser
Cc: Greg KH, sachin.kamat, devel, linux-kernel, Dulshani Gunawardhana
Thanks for review.
OK. I will try to change all of OS_kmalloc to kmalloc/kzalloc.
And I also check GFP_DMA flag in kmalloc/kzalloc.
Regards,
Daeseok Youn
2014-03-05 19:04 GMT+09:00 Tobias Klauser <tklauser@distanz.ch>:
> On 2014-03-05 at 03:37:15 +0100, Daeseok Youn <daeseok.youn@gmail.com> wrote:
>>
>> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
>> ---
>> drivers/staging/cxt1e1/sbecom_inline_linux.h | 6 ++----
>> 1 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/cxt1e1/sbecom_inline_linux.h b/drivers/staging/cxt1e1/sbecom_inline_linux.h
>> index ba3ff3e..6dd1b55 100644
>> --- a/drivers/staging/cxt1e1/sbecom_inline_linux.h
>> +++ b/drivers/staging/cxt1e1/sbecom_inline_linux.h
>> @@ -46,11 +46,9 @@ void pci_write_32 (u_int32_t *p, u_int32_t v);
>> static inline void *
>> OS_kmalloc (size_t size)
>> {
>> - char *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA);
>> + char *ptr = kzalloc(size, GFP_KERNEL | GFP_DMA);
>>
>> - if (ptr)
>> - memset (ptr, 0, size);
>> - return ptr;
>> + return ptr;
>> }
>
> It would probably be even better to get rid of this function altogether
> and replace all calls to it by kmalloc/kzalloc.
>
> From a quick look at the users of OS_kmalloc, it also looks like GFP_DMA
> isn't needed for all of them.
>
> Cheers
> Tobias
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-06 7:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-05 2:37 [PATCH] staging: cxt1e1: use kzalloc instead of kmalloc/memset 0 Daeseok Youn
2014-03-05 10:04 ` Tobias Klauser
2014-03-06 7:02 ` DaeSeok Youn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®