Skip to contentSkip to conversation

drivers: staging: android: Fix style/formatting issues

PATCH In review Nick Fox 2 participants 7 messages Aug 23, 2017 1 message not in the archive Staging

lore
Share & tools
lore

Nick Fox

author
#0 lore raw

PATCH 1/1 drivers: staging: android: Fix style/formatting issues

Fix two issues reported by checkpatch. The first removes an extra blank line, the second changes an argument to kmalloc(). Original checkpatch output is below:

ion/ion_cma_heap.c:34: CHECK: Please don't use multiple blank lines ion/ion_cma_heap.c:49: CHECK: Prefer kmalloc(sizeof(*table)...) over kmalloc(sizeof(struct sg_table)...)
total: 0 errors, 0 warnings, 2 checks, 128 lines checked

---
 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 a0949bc0dcf4..bb2c1449cbcf 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(*table), GFP_KERNEL);
 	if (!table)
 		goto err;
 
Signature · 1 line
2.13.5
#1 lore raw
Quoted 3 lines · Nick Fox

Fix two issues reported by checkpatch. The first removes an extra blank line, the second changes an argument to kmalloc(). Original checkpatch output is below:

That should be two different patches, please break this up.

thanks,

greg k-h

author
#2 lore raw

PATCH 1/2 staging: android: ion: Remove extra line (checkpatch)

In reply to Nick Fox

Remove extra blank line (reported by checkpatch.pl)

---
 drivers/staging/android/ion/ion_cma_heap.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/android/ion/ion_cma_heap.c +0 -1
index a0949bc0dcf4..b06f4cee9c7c 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,
Signature · 1 line
2.13.5
author
#3 lore raw

PATCH 2/2 staging: android: ion: Change argument to kmalloc (checkpatch)

Change argument to kmalloc() to fix style issue, reported by checkpatch

---
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion_cma_heap.c +1 -1
index b06f4cee9c7c..bb2c1449cbcf 100644
@@ -45,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(*table), GFP_KERNEL);
 	if (!table)
 		goto err;
 
Signature · 1 line
2.13.5
#4 lore raw

Re: [PATCH 2/2] staging: android: ion: Change argument to kmalloc (checkpatch)

Quoted 12 lines · Nick Fox

Change argument to kmalloc() to fix style issue, reported by checkpatch

---
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion_cma_heap.c +0 -0
index b06f4cee9c7c..bb2c1449cbcf 100644

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

Quoted 5 lines
drivers/staging/android/ion/ion_cma_heap.c +1 -1
@@ -45,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(*table), GFP_KERNEL);

This doesn't apply to linux-next at all, what tree are you working against? Always work off of the correct tree please...

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CAAmVuH--a1Z0BmTAjvR5O-zobwGsVCQ+BqBZ8Wunsc0SY5W4Dw@mail.gmail.com

#6 lore raw

Re: [PATCH 2/2] staging: android: ion: Change argument to kmalloc (checkpatch)

Quoted 3 lines · Nick Fox

Apologies for the spam, but I think my last reply got rejected by Google for some reason and didn't get delivered to the linux-kernel mailing list. My original reply is below:

You can not send html email to vger.kernel.org, it will be rejected, please fix up your email client. Also please do not top-post on mailing lists:

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 4 lines

"Sorry about that--I'm brand new to contributing and got mixed up about which tree to use. Just so I'm understanding correctly, https://git.kernel.org/pub/
scm/linux/kernel/git/next/linux-next.git/ is the tree I should be using to work on staging drivers?

It is the tree you should be using to do any new kernel development on, but if you specifically want to work on staging drivers, the staging.git tree on git.kernel.org is the place to work off of, specifically the staging-next branch there.

hope this helps,

greg k-h

#7 lore raw

Re: [PATCH 1/2] staging: android: ion: Remove extra line (checkpatch)

In reply to Nick Fox
Quoted 12 lines · Nick Fox

Remove extra blank line (reported by checkpatch.pl)

---
 drivers/staging/android/ion/ion_cma_heap.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/android/ion/ion_cma_heap.c +0 -0
index a0949bc0dcf4..b06f4cee9c7c 100644

drivers/staging/android/ion/ion_cma_heap.c struct ion_cma_heap { · line 34

Quoted 4 lines
drivers/staging/android/ion/ion_cma_heap.c +0 -1
@@ -31,7 +31,6 @@ struct ion_cma_heap {
 
 #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)
 
-

Also doesn't apply...