Skip to contentSkip to conversation

Staging: Android: fix code style in ion_cma_heap.c

PATCH In review Abishek V Ashok 4 participants 4 messages Aug 24, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: Android: fix code style in ion_cma_heap.c

This is a patch to the ion_cma_heap.c file in /drivers/staging/andrioid/ion that fixes a blank line and kmalloc size warning found by the checkpatch.pl tool.

---
 drivers/staging/android/ion/ion_cma_heap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/android/ion/ion_cma_heap.c +1 -2
index a0949bc0..1589b9e0 100644
@@ -31,7 +31,6 @@ struct ion_cma_heap {
 
 #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)
 
-
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 			    unsigned long len,
@@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	if (!pages)
 		return -ENOMEM;
 
-	table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+	table = kmalloc(sizeof(struct * table), GFP_KERNEL);
 	if (!table)
 		goto err;
 

--
2.11.0

#1 lore raw
Quoted 4 lines · Abishek V Ashok

This is a patch to the ion_cma_heap.c file in /drivers/staging/andrioid/ion that fixes a blank line and kmalloc size warning found by the checkpatch.pl tool.

You've done two things in this patch, please stick to a single change per patch.

Quoted 29 lines
---
 drivers/staging/android/ion/ion_cma_heap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/android/ion/ion_cma_heap.c +1 -3
index a0949bc0..1589b9e0 100644
@@ -31,7 +31,6 @@ struct ion_cma_heap {
 
 #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)
 
-
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 			    unsigned long len,
@@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	if (!pages)
 		return -ENOMEM;
 
-	table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+	table = kmalloc(sizeof(struct * table), GFP_KERNEL);
 	if (!table)
 		goto err;
 
--

2.11.0

#2 lore raw
In reply to Abishek V Ashok

drivers/staging/android/ion/ion_cma_heap.c static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, · line 48

Quoted 6 lines · Abishek V Ashok
drivers/staging/android/ion/ion_cma_heap.c +1 -1
@@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	if (!pages)
 		return -ENOMEM;
 
-	table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+	table = kmalloc(sizeof(struct * table), GFP_KERNEL);

You didn't try compile this.

regards,
dan carpenter

#3 lore raw
In reply to Abishek V Ashok
Quoted 3 lines · Abishek V Ashok

This is a patch to the ion_cma_heap.c file in /drivers/staging/andrioid/ion that fixes a blank line and kmalloc size warning found by the checkpatch.pl tool.

[]

drivers/staging/android/ion/ion_cma_heap.c

Quoted 1 line
drivers/staging/android/ion/ion_cma_heap.c +0 -0

[]

drivers/staging/android/ion/ion_cma_heap.c static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, · line 48

Quoted 6 lines
drivers/staging/android/ion/ion_cma_heap.c +1 -1
@@ -46,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	if (!pages)
 		return -ENOMEM;
 
-	table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+	table = kmalloc(sizeof(struct * table), GFP_KERNEL);

Please make sure you compile the files modified by your proposed patches before sending the patches.