All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
@ 2010-05-11 18:28 ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2010-05-11 18:28 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Drop cast on the result of kmalloc and similar functions.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
@@

- (T *)
  (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/x86/kernel/tlb_uv.c            |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 7fea555..9064179 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
 	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
 	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
 	 */
-	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
+	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
 		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
 	BUG_ON(!bau_desc);
 
@@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
 	struct bau_payload_queue_entry *pqp_malloc;
 	struct bau_control *bcp;
 
-	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
+	pqp = kmalloc_node(
 		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
 		GFP_KERNEL, node);
 	BUG_ON(!pqp);
@@ -1286,8 +1286,7 @@ static void uv_init_per_cpu(int nuvhubs)
 	};
 	struct uvhub_desc *uvhub_descs;
 
-	uvhub_descs = (struct uvhub_desc *)
-		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
+	uvhub_descs = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
 	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
 	for_each_present_cpu(cpu) {
 		bcp = &per_cpu(bau_control, cpu);

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

* [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
@ 2010-05-11 18:28 ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2010-05-11 18:28 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Drop cast on the result of kmalloc and similar functions.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
@@

- (T *)
  (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/x86/kernel/tlb_uv.c            |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 7fea555..9064179 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
 	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
 	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
 	 */
-	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
+	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
 		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
 	BUG_ON(!bau_desc);
 
@@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
 	struct bau_payload_queue_entry *pqp_malloc;
 	struct bau_control *bcp;
 
-	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
+	pqp = kmalloc_node(
 		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
 		GFP_KERNEL, node);
 	BUG_ON(!pqp);
@@ -1286,8 +1286,7 @@ static void uv_init_per_cpu(int nuvhubs)
 	};
 	struct uvhub_desc *uvhub_descs;
 
-	uvhub_descs = (struct uvhub_desc *)
-		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
+	uvhub_descs = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
 	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
 	for_each_present_cpu(cpu) {
 		bcp = &per_cpu(bau_control, cpu);

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

* Re: [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
  2010-05-11 18:28 ` Julia Lawall
@ 2010-05-12  7:29   ` walter harms
  -1 siblings, 0 replies; 8+ messages in thread
From: walter harms @ 2010-05-12  7:29 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors



Julia Lawall schrieb:
> From: Julia Lawall <julia@diku.dk>
> 
> Drop cast on the result of kmalloc and similar functions.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> type T;
> @@
> 
> - (T *)
>   (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
>    kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  arch/x86/kernel/tlb_uv.c            |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
> index 7fea555..9064179 100644
> --- a/arch/x86/kernel/tlb_uv.c
> +++ b/arch/x86/kernel/tlb_uv.c
> @@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
>  	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
>  	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
>  	 */
> -	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
> +	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
>  		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
>  	BUG_ON(!bau_desc);
>  
> @@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
>  	struct bau_payload_queue_entry *pqp_malloc;
>  	struct bau_control *bcp;
>  
> -	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
> +	pqp = kmalloc_node(
>  		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
>  		GFP_KERNEL, node);
>  	BUG_ON(!pqp);
> @@ -1286,8 +1286,7 @@ static void uv_init_per_cpu(int nuvhubs)
>  	};
>  	struct uvhub_desc *uvhub_descs;
>  
> -	uvhub_descs = (struct uvhub_desc *)
> -		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
> +	uvhub_descs = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
>  	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
>  	for_each_present_cpu(cpu) {
>  		bcp = &per_cpu(bau_control, cpu);

kzmalloc() ?

BUG_ON(!uvhub_descs); ?

re,
 wh

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

* Re: [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
@ 2010-05-12  7:29   ` walter harms
  0 siblings, 0 replies; 8+ messages in thread
From: walter harms @ 2010-05-12  7:29 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors



Julia Lawall schrieb:
> From: Julia Lawall <julia@diku.dk>
> 
> Drop cast on the result of kmalloc and similar functions.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> type T;
> @@
> 
> - (T *)
>   (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
>    kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  arch/x86/kernel/tlb_uv.c            |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
> index 7fea555..9064179 100644
> --- a/arch/x86/kernel/tlb_uv.c
> +++ b/arch/x86/kernel/tlb_uv.c
> @@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
>  	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
>  	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
>  	 */
> -	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
> +	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
>  		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
>  	BUG_ON(!bau_desc);
>  
> @@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
>  	struct bau_payload_queue_entry *pqp_malloc;
>  	struct bau_control *bcp;
>  
> -	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
> +	pqp = kmalloc_node(
>  		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
>  		GFP_KERNEL, node);
>  	BUG_ON(!pqp);
> @@ -1286,8 +1286,7 @@ static void uv_init_per_cpu(int nuvhubs)
>  	};
>  	struct uvhub_desc *uvhub_descs;
>  
> -	uvhub_descs = (struct uvhub_desc *)
> -		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
> +	uvhub_descs = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
>  	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
>  	for_each_present_cpu(cpu) {
>  		bcp = &per_cpu(bau_control, cpu);

kzmalloc() ?

BUG_ON(!uvhub_descs); ?

re,
 wh

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

* Re: [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
  2010-05-12  7:29   ` walter harms
@ 2010-05-12  8:21     ` Julia Lawall
  -1 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2010-05-12  8:21 UTC (permalink / raw)
  To: walter harms
  Cc: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Drop cast on the result of kmalloc and similar functions.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
@@

- (T *)
  (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/x86/kernel/tlb_uv.c            |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 7fea555..217c361 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
 	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
 	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
 	 */
-	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
+	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
 		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
 	BUG_ON(!bau_desc);
 
@@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
 	struct bau_payload_queue_entry *pqp_malloc;
 	struct bau_control *bcp;
 
-	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
+	pqp = kmalloc_node(
 		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
 		GFP_KERNEL, node);
 	BUG_ON(!pqp);
@@ -1286,9 +1286,8 @@ static void uv_init_per_cpu(int nuvhubs)
 	};
 	struct uvhub_desc *uvhub_descs;
 
-	uvhub_descs = (struct uvhub_desc *)
-		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
-	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
+	uvhub_descs = kzalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
+	BUG_ON(!uvhub_descs);
 	for_each_present_cpu(cpu) {
 		bcp = &per_cpu(bau_control, cpu);
 		memset(bcp, 0, sizeof(struct bau_control));

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

* Re: [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
@ 2010-05-12  8:21     ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2010-05-12  8:21 UTC (permalink / raw)
  To: walter harms
  Cc: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Drop cast on the result of kmalloc and similar functions.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
@@

- (T *)
  (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/x86/kernel/tlb_uv.c            |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 7fea555..217c361 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
 	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
 	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
 	 */
-	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
+	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
 		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
 	BUG_ON(!bau_desc);
 
@@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
 	struct bau_payload_queue_entry *pqp_malloc;
 	struct bau_control *bcp;
 
-	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
+	pqp = kmalloc_node(
 		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
 		GFP_KERNEL, node);
 	BUG_ON(!pqp);
@@ -1286,9 +1286,8 @@ static void uv_init_per_cpu(int nuvhubs)
 	};
 	struct uvhub_desc *uvhub_descs;
 
-	uvhub_descs = (struct uvhub_desc *)
-		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
-	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
+	uvhub_descs = kzalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
+	BUG_ON(!uvhub_descs);
 	for_each_present_cpu(cpu) {
 		bcp = &per_cpu(bau_control, cpu);
 		memset(bcp, 0, sizeof(struct bau_control));

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

* Re: [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
  2010-05-12  8:21     ` Julia Lawall
@ 2010-05-12  8:56       ` Julia Lawall
  -1 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2010-05-12  8:56 UTC (permalink / raw)
  To: walter harms
  Cc: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Drop cast on the result of kmalloc and similar functions.
The third occurrence is additionally modified by hand to use kcalloc and to
check that the result of the allocation is not NULL.

The semantic patch that makes the drop cast change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
@@

- (T *)
  (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/x86/kernel/tlb_uv.c            |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 7fea555..97e790c 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
 	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
 	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
 	 */
-	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
+	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
 		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
 	BUG_ON(!bau_desc);
 
@@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
 	struct bau_payload_queue_entry *pqp_malloc;
 	struct bau_control *bcp;
 
-	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
+	pqp = kmalloc_node(
 		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
 		GFP_KERNEL, node);
 	BUG_ON(!pqp);
@@ -1286,9 +1286,8 @@ static void uv_init_per_cpu(int nuvhubs)
 	};
 	struct uvhub_desc *uvhub_descs;
 
-	uvhub_descs = (struct uvhub_desc *)
-		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
-	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
+	uvhub_descs = kcalloc(nuvhubs, sizeof(struct uvhub_desc), GFP_KERNEL);
+	BUG_ON(!uvhub_descs);
 	for_each_present_cpu(cpu) {
 		bcp = &per_cpu(bau_control, cpu);
 		memset(bcp, 0, sizeof(struct bau_control));

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

* Re: [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast
@ 2010-05-12  8:56       ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2010-05-12  8:56 UTC (permalink / raw)
  To: walter harms
  Cc: Thomas Gleixner, Ingo Molnar, ,
	H. Peter Anvin, x86, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Drop cast on the result of kmalloc and similar functions.
The third occurrence is additionally modified by hand to use kcalloc and to
check that the result of the allocation is not NULL.

The semantic patch that makes the drop cast change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
@@

- (T *)
  (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
   kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/x86/kernel/tlb_uv.c            |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 7fea555..97e790c 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
 	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
 	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
 	 */
-	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
+	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
 		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
 	BUG_ON(!bau_desc);
 
@@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
 	struct bau_payload_queue_entry *pqp_malloc;
 	struct bau_control *bcp;
 
-	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
+	pqp = kmalloc_node(
 		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
 		GFP_KERNEL, node);
 	BUG_ON(!pqp);
@@ -1286,9 +1286,8 @@ static void uv_init_per_cpu(int nuvhubs)
 	};
 	struct uvhub_desc *uvhub_descs;
 
-	uvhub_descs = (struct uvhub_desc *)
-		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
-	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
+	uvhub_descs = kcalloc(nuvhubs, sizeof(struct uvhub_desc), GFP_KERNEL);
+	BUG_ON(!uvhub_descs);
 	for_each_present_cpu(cpu) {
 		bcp = &per_cpu(bau_control, cpu);
 		memset(bcp, 0, sizeof(struct bau_control));

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

end of thread, other threads:[~2010-05-12  9:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-11 18:28 [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast Julia Lawall
2010-05-11 18:28 ` Julia Lawall
2010-05-12  7:29 ` walter harms
2010-05-12  7:29   ` walter harms
2010-05-12  8:21   ` Julia Lawall
2010-05-12  8:21     ` Julia Lawall
2010-05-12  8:56     ` Julia Lawall
2010-05-12  8:56       ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.