All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] Fix checkpatch issues
@ 2017-09-26 16:01 Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 01/10] Staging: media: atomisp: Use kmalloc_array instead of kmalloc Georgiana Chelu
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

This patchset was created on Julia recommendation to
remove 'out of memory' messages and unlikely checks.

* [1/10] kmalloc generates a backtrace on failure and it will
show the same information as the removed messages.
* [2/10] unlikely checks are not necessary on NULL pointers
after a memory allocation.

Also, new changes were made to improve the code from hmm_bo.c file.
Some of the issues were already in the file, others were introduced
on previous patches of this set.
These new changes are available on [3/10-10/10] patches.

Changes in v2:
* Nothing changed in 1/10
* New added 2/10 - 10/10


Georgiana Chelu (10):
  Staging: media: atomisp: Use kmalloc_array instead of kmalloc
  Staging: media: atomisp: Remove useless 'out of memory' messages
  Staging: media: atomisp: Remove unlikely from NULL pointer check
  Staging: media: atomisp: Adjust checks for null pointers
  Staging: media: atomisp: Remove return statement from void function
  Staging: media: atomisp: Add spaces around bitwise OR
  Staging: media: atomisp: Remove braces {} for single statement blocks
  Staging: media: atomisp: Align code with open parenthesis
  Staging: media: atomisp: Merge quoted string split across lines
  Staging: media: atomisp: Split lines wiht over 80 characters

 .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c        | 164 ++++++++++-----------
 1 file changed, 76 insertions(+), 88 deletions(-)

-- 
2.7.4



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

* [PATCH v2 01/10] Staging: media: atomisp: Use kmalloc_array instead of kmalloc
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Prefer kmalloc_array over kmalloc with multiply
because kmalloc_array performs additional checks
before memory allocation.

Fix the following issue reported by checkpatch.pl:
* WARNING: Prefer kmalloc_array over kmalloc with multiply

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* nothing changed in the patch
* the patch was added to a patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 11162f5..5232327 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -725,7 +725,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 
 	pgnr = bo->pgnr;
 
-	bo->page_obj = kmalloc(sizeof(struct hmm_page_object) * pgnr,
+	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
 				GFP_KERNEL);
 	if (unlikely(!bo->page_obj)) {
 		dev_err(atomisp_dev, "out of memory for bo->page_obj\n");
@@ -990,13 +990,13 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	struct vm_area_struct *vma;
 	struct page **pages;
 
-	pages = kmalloc(sizeof(struct page *) * bo->pgnr, GFP_KERNEL);
+	pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL);
 	if (unlikely(!pages)) {
 		dev_err(atomisp_dev, "out of memory for pages...\n");
 		return -ENOMEM;
 	}
 
-	bo->page_obj = kmalloc(sizeof(struct hmm_page_object) * bo->pgnr,
+	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
 		GFP_KERNEL);
 	if (unlikely(!bo->page_obj)) {
 		dev_err(atomisp_dev, "out of memory for bo->page_obj...\n");
@@ -1363,7 +1363,7 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached)
 		bo->status &= ~(HMM_BO_VMAPED | HMM_BO_VMAPED_CACHED);
 	}
 
-	pages = kmalloc(sizeof(*pages) * bo->pgnr, GFP_KERNEL);
+	pages = kmalloc_array(bo->pgnr, sizeof(*pages), GFP_KERNEL);
 	if (unlikely(!pages)) {
 		mutex_unlock(&bo->mutex);
 		dev_err(atomisp_dev, "out of memory for pages...\n");
-- 
2.7.4



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

* [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 01/10] Staging: media: atomisp: Use kmalloc_array instead of kmalloc Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-29 13:34   ` [Outreachy kernel] " Greg Kroah-Hartman
  2017-09-26 16:01 ` [PATCH v2 03/10] Staging: media: atomisp: Remove unlikely from NULL pointer check Georgiana Chelu
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

OOM (Out Of Memory Manager) reports memory allocation fails,
so there is no need for the error messages.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 5232327..8667466 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -728,7 +728,6 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
 				GFP_KERNEL);
 	if (unlikely(!bo->page_obj)) {
-		dev_err(atomisp_dev, "out of memory for bo->page_obj\n");
 		return -ENOMEM;
 	}
 
@@ -992,14 +991,12 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 
 	pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL);
 	if (unlikely(!pages)) {
-		dev_err(atomisp_dev, "out of memory for pages...\n");
 		return -ENOMEM;
 	}
 
 	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
 		GFP_KERNEL);
 	if (unlikely(!bo->page_obj)) {
-		dev_err(atomisp_dev, "out of memory for bo->page_obj...\n");
 		kfree(pages);
 		return -ENOMEM;
 	}
@@ -1366,7 +1363,6 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached)
 	pages = kmalloc_array(bo->pgnr, sizeof(*pages), GFP_KERNEL);
 	if (unlikely(!pages)) {
 		mutex_unlock(&bo->mutex);
-		dev_err(atomisp_dev, "out of memory for pages...\n");
 		return NULL;
 	}
 
-- 
2.7.4



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

* [PATCH v2 03/10] Staging: media: atomisp: Remove unlikely from NULL pointer check
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 01/10] Staging: media: atomisp: Use kmalloc_array instead of kmalloc Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-29 13:35   ` Greg Kroah-Hartman
  2017-09-26 16:01 ` [PATCH v2 04/10] Staging: media: atomisp: Adjust checks for null pointers Georgiana Chelu
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Remove unlikely because kmalloc uses it inside the source code.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 8667466..64f246f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -727,7 +727,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 
 	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
 				GFP_KERNEL);
-	if (unlikely(!bo->page_obj)) {
+	if (!bo->page_obj) {
 		return -ENOMEM;
 	}
 
@@ -990,13 +990,13 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	struct page **pages;
 
 	pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL);
-	if (unlikely(!pages)) {
+	if (!pages) {
 		return -ENOMEM;
 	}
 
 	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
 		GFP_KERNEL);
-	if (unlikely(!bo->page_obj)) {
+	if (!bo->page_obj) {
 		kfree(pages);
 		return -ENOMEM;
 	}
@@ -1361,7 +1361,7 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached)
 	}
 
 	pages = kmalloc_array(bo->pgnr, sizeof(*pages), GFP_KERNEL);
-	if (unlikely(!pages)) {
+	if (!pages) {
 		mutex_unlock(&bo->mutex);
 		return NULL;
 	}
-- 
2.7.4



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

* [PATCH v2 04/10] Staging: media: atomisp: Adjust checks for null pointers
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
                   ` (2 preceding siblings ...)
  2017-09-26 16:01 ` [PATCH v2 03/10] Staging: media: atomisp: Remove unlikely from NULL pointer check Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 05/10] Staging: media: atomisp: Remove return statement from void function Georgiana Chelu
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Rewrite the comparison to NULL for better coding style.

Fix issue reported by checkpatch.pl:
* CHECK: Comparison to NULL could be written

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 .../staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c  | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 64f246f..a2aa3bf 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -106,7 +106,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 
 	this = rb_entry(node, struct hmm_buffer_object, node);
 	if (this->pgnr == pgnr ||
-		(this->pgnr > pgnr && this->node.rb_left == NULL)) {
+		(this->pgnr > pgnr && !this->node.rb_left)) {
 		goto remove_bo_and_return;
 	} else {
 		if (this->pgnr < pgnr) {
@@ -132,7 +132,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 	 * 1. check if 'this->next' is NULL:
 	 *	yes: erase 'this' node and rebalance rbtree, return 'this'.
 	 */
-	if (this->next == NULL) {
+	if (!this->next) {
 		rb_erase(&this->node, &this->bdev->free_rbtree);
 		return this;
 	}
@@ -160,11 +160,11 @@ struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root,
 		bo = rb_entry(n, struct hmm_buffer_object, node);
 
 		if (bo->start > start) {
-			if (n->rb_left == NULL)
+			if (!n->rb_left)
 				return NULL;
 			n = n->rb_left;
 		} else if (bo->start < start) {
-			if (n->rb_right == NULL)
+			if (!n->rb_right)
 				return NULL;
 			n = n->rb_right;
 		} else {
@@ -185,13 +185,13 @@ struct hmm_buffer_object *__bo_search_by_addr_in_range(struct rb_root *root,
 		bo = rb_entry(n, struct hmm_buffer_object, node);
 
 		if (bo->start > start) {
-			if (n->rb_left == NULL)
+			if (!n->rb_left)
 				return NULL;
 			n = n->rb_left;
 		} else {
 			if (bo->end > start)
 				return bo;
-			if (n->rb_right == NULL)
+			if (!n->rb_right)
 				return NULL;
 			n = n->rb_right;
 		}
@@ -298,14 +298,14 @@ static void __bo_take_off_handling(struct hmm_buffer_object *bo)
 	 *	and does not have a linked list after bo, to take off this bo,
 	 *	we just need erase bo directly and rebalance the free rbtree
 	 */
-	if (bo->prev == NULL && bo->next == NULL) {
+	if (!bo->prev && !bo->next) {
 		rb_erase(&bo->node, &bdev->free_rbtree);
 	/* 2. when bo->next != NULL && bo->prev == NULL, bo is a rbtree node,
 	 *	and has a linked list,to take off this bo we need erase bo
 	 *	first, then, insert bo->next into free rbtree and rebalance
 	 *	the free rbtree
 	 */
-	} else if (bo->prev == NULL && bo->next != NULL) {
+	} else if (!bo->prev && bo->next) {
 		bo->next->prev = NULL;
 		rb_erase(&bo->node, &bdev->free_rbtree);
 		__bo_insert_to_free_rbtree(&bdev->free_rbtree, bo->next);
@@ -315,7 +315,7 @@ static void __bo_take_off_handling(struct hmm_buffer_object *bo)
 	 *	node, to take off this bo, we just need set the "prev/next"
 	 *	pointers to NULL, the free rbtree stays unchaged
 	 */
-	} else if (bo->prev != NULL && bo->next == NULL) {
+	} else if (bo->prev && !bo->next) {
 		bo->prev->next = NULL;
 		bo->prev = NULL;
 	/* 4. when bo->prev != NULL && bo->next != NULL ,bo is not a rbtree
@@ -1005,7 +1005,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	down_read(&current->mm->mmap_sem);
 	vma = find_vma(current->mm, (unsigned long)userptr);
 	up_read(&current->mm->mmap_sem);
-	if (vma == NULL) {
+	if (!vma) {
 		dev_err(atomisp_dev, "find_vma failed\n");
 		kfree(bo->page_obj);
 		kfree(pages);
-- 
2.7.4



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

* [PATCH v2 05/10] Staging: media: atomisp: Remove return statement from void function
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
                   ` (3 preceding siblings ...)
  2017-09-26 16:01 ` [PATCH v2 04/10] Staging: media: atomisp: Adjust checks for null pointers Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 06/10] Staging: media: atomisp: Add spaces around bitwise OR Georgiana Chelu
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

The return statement is not useful when it ends a void function.

Issue found by checkpatch.pl:
WARNING: void function return statements are not generally useful

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index a2aa3bf..abfdfe6 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -520,7 +520,6 @@ void hmm_bo_release(struct hmm_buffer_object *bo)
 	__bo_insert_to_free_rbtree(&bdev->free_rbtree, bo);
 
 	mutex_unlock(&bdev->rbtree_mutex);
-	return;
 }
 
 void hmm_bo_device_exit(struct hmm_bo_device *bdev)
@@ -700,8 +699,6 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
 			break;
 		}
 	}
-
-	return;
 }
 
 /*Allocate pages which will be used only by ISP*/
@@ -1411,7 +1408,6 @@ void hmm_bo_vunmap(struct hmm_buffer_object *bo)
 	}
 
 	mutex_unlock(&bo->mutex);
-	return;
 }
 
 void hmm_bo_ref(struct hmm_buffer_object *bo)
-- 
2.7.4



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

* [PATCH v2 06/10] Staging: media: atomisp: Add spaces around bitwise OR
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
                   ` (4 preceding siblings ...)
  2017-09-26 16:01 ` [PATCH v2 05/10] Staging: media: atomisp: Remove return statement from void function Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 07/10] Staging: media: atomisp: Remove braces {} for single statement blocks Georgiana Chelu
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Add spaces around operator to improve the code
readability.

Issue reported by checkpatch.pl script:
* CHECK: spaces preferred around that '|'

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index abfdfe6..06f6e48 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -1521,7 +1521,7 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 	vma->vm_private_data = bo;
 
 	vma->vm_ops = &hmm_bo_vm_ops;
-	vma->vm_flags |= VM_IO|VM_DONTEXPAND|VM_DONTDUMP;
+	vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 
 	/*
 	 * call hmm_bo_vm_open explictly.
-- 
2.7.4



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

* [PATCH v2 07/10] Staging: media: atomisp: Remove braces {} for single statement blocks
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
                   ` (5 preceding siblings ...)
  2017-09-26 16:01 ` [PATCH v2 06/10] Staging: media: atomisp: Add spaces around bitwise OR Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 08/10] Staging: media: atomisp: Align code with open parenthesis Georgiana Chelu
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Enhance the coding style by removing the
braces {} for single statement blocks.

Fix issue reported by checkpatch.pl script:
*WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 06f6e48..0dcdcdd 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -724,9 +724,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 
 	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
 				GFP_KERNEL);
-	if (!bo->page_obj) {
+	if (!bo->page_obj)
 		return -ENOMEM;
-	}
 
 	i = 0;
 	alloc_pgnr = 0;
@@ -987,9 +986,8 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	struct page **pages;
 
 	pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL);
-	if (!pages) {
+	if (!pages)
 		return -ENOMEM;
-	}
 
 	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
 		GFP_KERNEL);
-- 
2.7.4



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

* [PATCH v2 08/10] Staging: media: atomisp: Align code with open parenthesis
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
                   ` (6 preceding siblings ...)
  2017-09-26 16:01 ` [PATCH v2 07/10] Staging: media: atomisp: Remove braces {} for single statement blocks Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 09/10] Staging: media: atomisp: Merge quoted string split across lines Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 10/10] Staging: media: atomisp: Split lines wiht over 80 characters Georgiana Chelu
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Improve the code readability by aligning the code
with the open parenthesis.c

Fix issue reported by checkpatch.pl
* CHECK: Alignment should match open parenthesis

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c        | 119 ++++++++++-----------
 1 file changed, 59 insertions(+), 60 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 0dcdcdd..1781ee2 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -70,11 +70,11 @@ struct hmm_buffer_object *__bo_alloc(struct kmem_cache *bo_cache)
 }
 
 static int __bo_init(struct hmm_bo_device *bdev, struct hmm_buffer_object *bo,
-					unsigned int pgnr)
+		     unsigned int pgnr)
 {
 	check_bodev_null_return(bdev, -EINVAL);
 	var_equal_return(hmm_bo_device_inited(bdev), 0, -EINVAL,
-			"hmm_bo_device not inited yet.\n");
+			 "hmm_bo_device not inited yet.\n");
 	/* prevent zero size buffer object */
 	if (pgnr == 0) {
 		dev_err(atomisp_dev, "0 size buffer is not allowed.\n");
@@ -106,7 +106,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 
 	this = rb_entry(node, struct hmm_buffer_object, node);
 	if (this->pgnr == pgnr ||
-		(this->pgnr > pgnr && !this->node.rb_left)) {
+	    (this->pgnr > pgnr && !this->node.rb_left)) {
 		goto remove_bo_and_return;
 	} else {
 		if (this->pgnr < pgnr) {
@@ -151,7 +151,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 }
 
 struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root,
-							ia_css_ptr start)
+					      ia_css_ptr start)
 {
 	struct rb_node *n = root->rb_node;
 	struct hmm_buffer_object *bo;
@@ -176,7 +176,7 @@ struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root,
 }
 
 struct hmm_buffer_object *__bo_search_by_addr_in_range(struct rb_root *root,
-					unsigned int start)
+						       unsigned int start)
 {
 	struct rb_node *n = root->rb_node;
 	struct hmm_buffer_object *bo;
@@ -201,7 +201,7 @@ struct hmm_buffer_object *__bo_search_by_addr_in_range(struct rb_root *root,
 }
 
 static void __bo_insert_to_free_rbtree(struct rb_root *root,
-					struct hmm_buffer_object *bo)
+				       struct hmm_buffer_object *bo)
 {
 	struct rb_node **new = &(root->rb_node);
 	struct rb_node *parent = NULL;
@@ -332,7 +332,7 @@ static void __bo_take_off_handling(struct hmm_buffer_object *bo)
 }
 
 struct hmm_buffer_object *__bo_merge(struct hmm_buffer_object *bo,
-					struct hmm_buffer_object *next_bo)
+				     struct hmm_buffer_object *next_bo)
 {
 	struct hmm_bo_device *bdev;
 	unsigned long flags;
@@ -354,9 +354,9 @@ struct hmm_buffer_object *__bo_merge(struct hmm_buffer_object *bo,
  * hmm_bo_device functions.
  */
 int hmm_bo_device_init(struct hmm_bo_device *bdev,
-				struct isp_mmu_client *mmu_driver,
-				unsigned int vaddr_start,
-				unsigned int size)
+		       struct isp_mmu_client *mmu_driver,
+		       unsigned int vaddr_start,
+		       unsigned int size)
 {
 	struct hmm_buffer_object *bo;
 	unsigned long flags;
@@ -384,7 +384,7 @@ int hmm_bo_device_init(struct hmm_bo_device *bdev,
 	bdev->free_rbtree = RB_ROOT;
 
 	bdev->bo_cache = kmem_cache_create("bo_cache",
-				sizeof(struct hmm_buffer_object), 0, 0, NULL);
+					   sizeof(struct hmm_buffer_object), 0, 0, NULL);
 	if (!bdev->bo_cache) {
 		dev_err(atomisp_dev, "%s: create cache failed!\n", __func__);
 		isp_mmu_exit(&bdev->mmu);
@@ -416,14 +416,14 @@ int hmm_bo_device_init(struct hmm_bo_device *bdev,
 }
 
 struct hmm_buffer_object *hmm_bo_alloc(struct hmm_bo_device *bdev,
-					unsigned int pgnr)
+				       unsigned int pgnr)
 {
 	struct hmm_buffer_object *bo, *new_bo;
 	struct rb_root *root = &bdev->free_rbtree;
 
 	check_bodev_null_return(bdev, NULL);
 	var_equal_return(hmm_bo_device_inited(bdev), 0, NULL,
-			"hmm_bo_device not inited yet.\n");
+			 "hmm_bo_device not inited yet.\n");
 
 	if (pgnr == 0) {
 		dev_err(atomisp_dev, "0 size buffer is not allowed.\n");
@@ -504,15 +504,15 @@ void hmm_bo_release(struct hmm_buffer_object *bo)
 	next_bo = list_entry(bo->list.next, struct hmm_buffer_object, list);
 
 	if (bo->list.prev != &bdev->entire_bo_list &&
-		prev_bo->end == bo->start &&
-		(prev_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
+	    prev_bo->end == bo->start &&
+	    (prev_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
 		__bo_take_off_handling(prev_bo);
 		bo = __bo_merge(prev_bo, bo);
 	}
 
 	if (bo->list.next != &bdev->entire_bo_list &&
-		next_bo->start == bo->end &&
-		(next_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
+	    next_bo->start == bo->end &&
+	    (next_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
 		__bo_take_off_handling(next_bo);
 		bo = __bo_merge(bo, next_bo);
 	}
@@ -642,9 +642,9 @@ struct hmm_buffer_object *hmm_bo_device_search_vmap_start(
 
 
 static void free_private_bo_pages(struct hmm_buffer_object *bo,
-				struct hmm_pool *dypool,
-				struct hmm_pool *repool,
-				int free_pgnr)
+				  struct hmm_pool *dypool,
+				  struct hmm_pool *repool,
+				  int free_pgnr)
 {
 	int i, ret;
 
@@ -683,8 +683,7 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
 			ret = set_pages_wb(bo->page_obj[i].page, 1);
 			if (ret)
 				dev_err(atomisp_dev,
-						"set page to WB err ...ret = %d\n",
-							ret);
+					"set page to WB err ...ret = %d\n", ret);
 			/*
 			W/A: set_pages_wb seldom return value = -EFAULT
 			indicate that address of page is not in valid
@@ -703,10 +702,10 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
 
 /*Allocate pages which will be used only by ISP*/
 static int alloc_private_pages(struct hmm_buffer_object *bo,
-				int from_highmem,
-				bool cached,
-				struct hmm_pool *dypool,
-				struct hmm_pool *repool)
+			       int from_highmem,
+			       bool cached,
+			       struct hmm_pool *dypool,
+			       struct hmm_pool *repool)
 {
 	int ret;
 	unsigned int pgnr, order, blk_pgnr, alloc_pgnr;
@@ -723,7 +722,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 	pgnr = bo->pgnr;
 
 	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
-				GFP_KERNEL);
+				     GFP_KERNEL);
 	if (!bo->page_obj)
 		return -ENOMEM;
 
@@ -735,8 +734,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 	 */
 	if (dypool->pops && dypool->pops->pool_alloc_pages) {
 		alloc_pgnr = dypool->pops->pool_alloc_pages(dypool->pool_info,
-							bo->page_obj, pgnr,
-							cached);
+							    bo->page_obj, pgnr,
+							    cached);
 		hmm_mem_stat.dyc_size -= alloc_pgnr;
 
 		if (alloc_pgnr == pgnr)
@@ -822,8 +821,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 				ret = set_pages_uc(pages, blk_pgnr);
 				if (ret) {
 					dev_err(atomisp_dev,
-						     "set page uncacheable"
-							"failed.\n");
+						"set page uncacheable"
+						"failed.\n");
 
 					__free_pages(pages, order);
 
@@ -861,8 +860,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 }
 
 static void free_private_pages(struct hmm_buffer_object *bo,
-				struct hmm_pool *dypool,
-				struct hmm_pool *repool)
+			       struct hmm_pool *dypool,
+			       struct hmm_pool *repool)
 {
 	free_private_bo_pages(bo, dypool, repool, bo->pgnr);
 
@@ -959,8 +958,8 @@ static int __get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
 }
 
 static int get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
-		     unsigned long start, int nr_pages, int write, int force,
-		     struct page **pages, struct vm_area_struct **vmas)
+			    unsigned long start, int nr_pages, int write, int force,
+			    struct page **pages, struct vm_area_struct **vmas)
 {
 	int flags = FOLL_TOUCH;
 
@@ -978,7 +977,7 @@ static int get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
  * Convert user space virtual address into pages list
  */
 static int alloc_user_pages(struct hmm_buffer_object *bo,
-			      void *userptr, bool cached)
+			    void *userptr, bool cached)
 {
 	int page_nr;
 	int i;
@@ -990,7 +989,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 		return -ENOMEM;
 
 	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
-		GFP_KERNEL);
+				     GFP_KERNEL);
 	if (!bo->page_obj) {
 		kfree(pages);
 		return -ENOMEM;
@@ -1032,9 +1031,9 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	/* can be written by caller, not forced */
 	if (page_nr != bo->pgnr) {
 		dev_err(atomisp_dev,
-				"get_user_pages err: bo->pgnr = %d, "
-				"pgnr actually pinned = %d.\n",
-				bo->pgnr, page_nr);
+			"get_user_pages err: bo->pgnr = %d, "
+			"pgnr actually pinned = %d.\n",
+			bo->pgnr, page_nr);
 		goto out_of_mem;
 	}
 
@@ -1099,7 +1098,8 @@ int hmm_bo_alloc_pages(struct hmm_buffer_object *bo,
 	 */
 	if (type == HMM_BO_PRIVATE) {
 		ret = alloc_private_pages(bo, from_highmem,
-				cached, &dynamic_pool, &reserved_pool);
+					  cached, &dynamic_pool,
+					  &reserved_pool);
 	} else if (type == HMM_BO_USER) {
 		ret = alloc_user_pages(bo, userptr, cached);
 	} else {
@@ -1124,7 +1124,7 @@ int hmm_bo_alloc_pages(struct hmm_buffer_object *bo,
 status_err:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-			"buffer object has already page allocated.\n");
+		"buffer object has already page allocated.\n");
 	return -EINVAL;
 }
 
@@ -1155,7 +1155,7 @@ void hmm_bo_free_pages(struct hmm_buffer_object *bo)
 status_err2:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-			"buffer object not page allocated yet.\n");
+		"buffer object not page allocated yet.\n");
 }
 
 int hmm_bo_page_allocated(struct hmm_buffer_object *bo)
@@ -1190,7 +1190,7 @@ int hmm_bo_get_page_info(struct hmm_buffer_object *bo,
 
 status_err:
 	dev_err(atomisp_dev,
-			"buffer object not page allocated yet.\n");
+		"buffer object not page allocated yet.\n");
 	mutex_unlock(&bo->mutex);
 	return -EINVAL;
 }
@@ -1209,9 +1209,8 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 
 	mutex_lock(&bo->mutex);
 
-	check_bo_status_yes_goto(bo,
-				   HMM_BO_PAGE_ALLOCED | HMM_BO_ALLOCED,
-				   status_err1);
+	check_bo_status_yes_goto(bo, HMM_BO_PAGE_ALLOCED | HMM_BO_ALLOCED,
+				 status_err1);
 
 	check_bo_status_no_goto(bo, HMM_BO_BINDED, status_err2);
 
@@ -1241,7 +1240,7 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 	 */
 	if (bo->start != 0x0)
 		isp_mmu_flush_tlb_range(&bdev->mmu, bo->start,
-						(bo->pgnr << PAGE_SHIFT));
+					(bo->pgnr << PAGE_SHIFT));
 
 	bo->status |= HMM_BO_BINDED;
 
@@ -1259,7 +1258,7 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-			"setup MMU address mapping failed.\n");
+		"setup MMU address mapping failed.\n");
 	return ret;
 
 status_err2:
@@ -1269,7 +1268,7 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 status_err1:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-		     "buffer object vm_node or page not allocated.\n");
+		"buffer object vm_node or page not allocated.\n");
 	return -EINVAL;
 }
 
@@ -1287,9 +1286,9 @@ void hmm_bo_unbind(struct hmm_buffer_object *bo)
 	mutex_lock(&bo->mutex);
 
 	check_bo_status_yes_goto(bo,
-				   HMM_BO_PAGE_ALLOCED |
-				   HMM_BO_ALLOCED |
-				   HMM_BO_BINDED, status_err);
+				 HMM_BO_PAGE_ALLOCED |
+				 HMM_BO_ALLOCED |
+				 HMM_BO_BINDED, status_err);
 
 	bdev = bo->bdev;
 
@@ -1316,7 +1315,7 @@ void hmm_bo_unbind(struct hmm_buffer_object *bo)
 status_err:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-		     "buffer vm or page not allocated or not binded yet.\n");
+		"buffer vm or page not allocated or not binded yet.\n");
 }
 
 int hmm_bo_binded(struct hmm_buffer_object *bo)
@@ -1365,7 +1364,7 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached)
 		pages[i] = bo->page_obj[i].page;
 
 	bo->vmap_addr = vmap(pages, bo->pgnr, VM_MAP,
-		cached ? PAGE_KERNEL : PAGE_KERNEL_NOCACHE);
+			     cached ? PAGE_KERNEL : PAGE_KERNEL_NOCACHE);
 	if (unlikely(!bo->vmap_addr)) {
 		kfree(pages);
 		mutex_unlock(&bo->mutex);
@@ -1498,8 +1497,8 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 	 */
 	if ((start + pgnr_to_size(pgnr)) != end) {
 		dev_warn(atomisp_dev,
-			     "vma's address space size not equal"
-			     " to buffer object's size");
+			 "vma's address space size not equal"
+			 " to buffer object's size");
 		return -EINVAL;
 	}
 
@@ -1508,9 +1507,9 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 		pfn = page_to_pfn(bo->page_obj[i].page);
 		if (remap_pfn_range(vma, virt, pfn, PAGE_SIZE, PAGE_SHARED)) {
 			dev_warn(atomisp_dev,
-					"remap_pfn_range failed:"
-					" virt = 0x%x, pfn = 0x%x,"
-					" mapped_pgnr = %d\n", virt, pfn, 1);
+				 "remap_pfn_range failed:"
+				 " virt = 0x%x, pfn = 0x%x,"
+				 " mapped_pgnr = %d\n", virt, pfn, 1);
 			return -EINVAL;
 		}
 		virt += PAGE_SIZE;
-- 
2.7.4



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

* [PATCH v2 09/10] Staging: media: atomisp: Merge quoted string split across lines
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
                   ` (7 preceding siblings ...)
  2017-09-26 16:01 ` [PATCH v2 08/10] Staging: media: atomisp: Align code with open parenthesis Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  2017-09-26 16:01 ` [PATCH v2 10/10] Staging: media: atomisp: Split lines wiht over 80 characters Georgiana Chelu
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Prefer merging quoted strings on one line than splitting them,
even if the line exceeds 80 characters. It is easier to
read and grep for strings that are not split.

Warning found by the checkpatch.pl script:
* WARNING: quoted string split across lines

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 1781ee2..48f801c 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -821,8 +821,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 				ret = set_pages_uc(pages, blk_pgnr);
 				if (ret) {
 					dev_err(atomisp_dev,
-						"set page uncacheable"
-						"failed.\n");
+						"set page uncacheable failed.\n");
 
 					__free_pages(pages, order);
 
@@ -1031,8 +1030,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	/* can be written by caller, not forced */
 	if (page_nr != bo->pgnr) {
 		dev_err(atomisp_dev,
-			"get_user_pages err: bo->pgnr = %d, "
-			"pgnr actually pinned = %d.\n",
+			"get_user_pages err: bo->pgnr = %d, pgnr actually pinned = %d.\n",
 			bo->pgnr, page_nr);
 		goto out_of_mem;
 	}
@@ -1497,8 +1495,7 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 	 */
 	if ((start + pgnr_to_size(pgnr)) != end) {
 		dev_warn(atomisp_dev,
-			 "vma's address space size not equal"
-			 " to buffer object's size");
+			 "vma's address space size not equal to buffer object's size");
 		return -EINVAL;
 	}
 
@@ -1507,9 +1504,8 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 		pfn = page_to_pfn(bo->page_obj[i].page);
 		if (remap_pfn_range(vma, virt, pfn, PAGE_SIZE, PAGE_SHARED)) {
 			dev_warn(atomisp_dev,
-				 "remap_pfn_range failed:"
-				 " virt = 0x%x, pfn = 0x%x,"
-				 " mapped_pgnr = %d\n", virt, pfn, 1);
+				 "remap_pfn_range failed: virt = 0x%x, pfn = 0x%x, mapped_pgnr = %d\n",
+				 virt, pfn, 1);
 			return -EINVAL;
 		}
 		virt += PAGE_SIZE;
-- 
2.7.4



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

* [PATCH v2 10/10] Staging: media: atomisp: Split lines wiht over 80 characters
  2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
                   ` (8 preceding siblings ...)
  2017-09-26 16:01 ` [PATCH v2 09/10] Staging: media: atomisp: Merge quoted string split across lines Georgiana Chelu
@ 2017-09-26 16:01 ` Georgiana Chelu
  9 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-09-26 16:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Lines with over 80 characters are difficult to read.
Thus, improve the coding style by writing the code
on multiple lines.

Issue found the checkpatch script:
* WARNING: line over 80 characters

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 48f801c..fbf1004 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -384,7 +384,8 @@ int hmm_bo_device_init(struct hmm_bo_device *bdev,
 	bdev->free_rbtree = RB_ROOT;
 
 	bdev->bo_cache = kmem_cache_create("bo_cache",
-					   sizeof(struct hmm_buffer_object), 0, 0, NULL);
+					   sizeof(struct hmm_buffer_object),
+					   0, 0, NULL);
 	if (!bdev->bo_cache) {
 		dev_err(atomisp_dev, "%s: create cache failed!\n", __func__);
 		isp_mmu_exit(&bdev->mmu);
@@ -683,7 +684,8 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
 			ret = set_pages_wb(bo->page_obj[i].page, 1);
 			if (ret)
 				dev_err(atomisp_dev,
-					"set page to WB err ...ret = %d\n", ret);
+					"set page to WB err ...ret = %d\n",
+					ret);
 			/*
 			W/A: set_pages_wb seldom return value = -EFAULT
 			indicate that address of page is not in valid
@@ -957,8 +959,9 @@ static int __get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
 }
 
 static int get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
-			    unsigned long start, int nr_pages, int write, int force,
-			    struct page **pages, struct vm_area_struct **vmas)
+			    unsigned long start, int nr_pages, int write,
+			    int force, struct page **pages,
+			    struct vm_area_struct **vmas)
 {
 	int flags = FOLL_TOUCH;
 
-- 
2.7.4



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

* Re: [Outreachy kernel] [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages
  2017-09-26 16:01 ` [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
@ 2017-09-29 13:34   ` Greg Kroah-Hartman
  2017-10-01 11:37     ` Georgiana Chelu
  0 siblings, 1 reply; 16+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-29 13:34 UTC (permalink / raw)
  To: Georgiana Chelu; +Cc: outreachy-kernel, Mauro Carvalho Chehab

On Tue, Sep 26, 2017 at 09:01:30AM -0700, Georgiana Chelu wrote:
> OOM (Out Of Memory Manager) reports memory allocation fails,
> so there is no need for the error messages.
> 
> Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
> ---
> 
> Changes in v2:
> * this is a new patch added to the patchset
> 
>  drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> index 5232327..8667466 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> @@ -728,7 +728,6 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
>  	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
>  				GFP_KERNEL);
>  	if (unlikely(!bo->page_obj)) {
> -		dev_err(atomisp_dev, "out of memory for bo->page_obj\n");
>  		return -ENOMEM;
>  	}

The { } should also be removed when you do this.  Please fix that up
here.

thanks,

greg k-h


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

* Re: [PATCH v2 03/10] Staging: media: atomisp: Remove unlikely from NULL pointer check
  2017-09-26 16:01 ` [PATCH v2 03/10] Staging: media: atomisp: Remove unlikely from NULL pointer check Georgiana Chelu
@ 2017-09-29 13:35   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-29 13:35 UTC (permalink / raw)
  To: Georgiana Chelu; +Cc: outreachy-kernel, Mauro Carvalho Chehab

On Tue, Sep 26, 2017 at 09:01:31AM -0700, Georgiana Chelu wrote:
> Remove unlikely because kmalloc uses it inside the source code.
> 
> Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
> ---
> 
> Changes in v2:
> * this is a new patch added to the patchset

As I didn't take patch 2, I can't take this one.  Please fix up and
resend the remaining patches in this series.

thanks,

greg k-h


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

* Re: [Outreachy kernel] [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages
  2017-09-29 13:34   ` [Outreachy kernel] " Greg Kroah-Hartman
@ 2017-10-01 11:37     ` Georgiana Chelu
  2017-10-01 11:47       ` Julia Lawall
  0 siblings, 1 reply; 16+ messages in thread
From: Georgiana Chelu @ 2017-10-01 11:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: outreachy-kernel, Mauro Carvalho Chehab

On 29 September 2017 at 16:34, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Sep 26, 2017 at 09:01:30AM -0700, Georgiana Chelu wrote:
>> OOM (Out Of Memory Manager) reports memory allocation fails,
>> so there is no need for the error messages.
>>
>> Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
>> ---
>>
>> Changes in v2:
>> * this is a new patch added to the patchset
>>
>>  drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
>> index 5232327..8667466 100644
>> --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
>> +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
>> @@ -728,7 +728,6 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
>>       bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
>>                               GFP_KERNEL);
>>       if (unlikely(!bo->page_obj)) {
>> -             dev_err(atomisp_dev, "out of memory for bo->page_obj\n");
>>               return -ENOMEM;
>>       }
>
> The { } should also be removed when you do this.  Please fix that up
> here.
>

This fix is done in
[PATCH v2 07/10] Staging: media: atomisp:
    Remove braces {} for single statement blocks

Do you say that is better to remove the {} in 02/10?

Thank you,
Georgiana

> thanks,
>
> greg k-h


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

* Re: [Outreachy kernel] [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages
  2017-10-01 11:37     ` Georgiana Chelu
@ 2017-10-01 11:47       ` Julia Lawall
  2017-10-01 11:56         ` Georgiana Chelu
  0 siblings, 1 reply; 16+ messages in thread
From: Julia Lawall @ 2017-10-01 11:47 UTC (permalink / raw)
  To: Georgiana Chelu
  Cc: Greg Kroah-Hartman, outreachy-kernel, Mauro Carvalho Chehab



On Sun, 1 Oct 2017, Georgiana Chelu wrote:

> On 29 September 2017 at 16:34, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Tue, Sep 26, 2017 at 09:01:30AM -0700, Georgiana Chelu wrote:
> >> OOM (Out Of Memory Manager) reports memory allocation fails,
> >> so there is no need for the error messages.
> >>
> >> Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
> >> ---
> >>
> >> Changes in v2:
> >> * this is a new patch added to the patchset
> >>
> >>  drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 4 ----
> >>  1 file changed, 4 deletions(-)
> >>
> >> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> >> index 5232327..8667466 100644
> >> --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> >> +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> >> @@ -728,7 +728,6 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
> >>       bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
> >>                               GFP_KERNEL);
> >>       if (unlikely(!bo->page_obj)) {
> >> -             dev_err(atomisp_dev, "out of memory for bo->page_obj\n");
> >>               return -ENOMEM;
> >>       }
> >
> > The { } should also be removed when you do this.  Please fix that up
> > here.
> >
>
> This fix is done in
> [PATCH v2 07/10] Staging: media: atomisp:
>     Remove braces {} for single statement blocks
>
> Do you say that is better to remove the {} in 02/10?

Yes.  When you make a change, you should clean immediately up any
checkpatch warnings that you introduce.

julia

>
> Thank you,
> Georgiana
>
> > thanks,
> >
> > greg k-h
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALta04wMbvf3BDh9%2B_7TT_VbnApMt3HfqwD%2B_4qSNBpY2xaUQQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages
  2017-10-01 11:47       ` Julia Lawall
@ 2017-10-01 11:56         ` Georgiana Chelu
  0 siblings, 0 replies; 16+ messages in thread
From: Georgiana Chelu @ 2017-10-01 11:56 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Greg Kroah-Hartman, outreachy-kernel, Mauro Carvalho Chehab

On 1 October 2017 at 14:47, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Sun, 1 Oct 2017, Georgiana Chelu wrote:
>
>> On 29 September 2017 at 16:34, Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org> wrote:
>> > On Tue, Sep 26, 2017 at 09:01:30AM -0700, Georgiana Chelu wrote:
>> >> OOM (Out Of Memory Manager) reports memory allocation fails,
>> >> so there is no need for the error messages.
>> >>
>> >> Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
>> >> ---
>> >>
>> >> Changes in v2:
>> >> * this is a new patch added to the patchset
>> >>
>> >>  drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 4 ----
>> >>  1 file changed, 4 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
>> >> index 5232327..8667466 100644
>> >> --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
>> >> +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
>> >> @@ -728,7 +728,6 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
>> >>       bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
>> >>                               GFP_KERNEL);
>> >>       if (unlikely(!bo->page_obj)) {
>> >> -             dev_err(atomisp_dev, "out of memory for bo->page_obj\n");
>> >>               return -ENOMEM;
>> >>       }
>> >
>> > The { } should also be removed when you do this.  Please fix that up
>> > here.
>> >
>>
>> This fix is done in
>> [PATCH v2 07/10] Staging: media: atomisp:
>>     Remove braces {} for single statement blocks
>>
>> Do you say that is better to remove the {} in 02/10?
>
> Yes.  When you make a change, you should clean immediately up any
> checkpatch warnings that you introduce.
>

I see .. Thank you very much! I will resend the patchset.


Georgiana

> julia
>
>>
>> Thank you,
>> Georgiana
>>
>> > thanks,
>> >
>> > greg k-h
>>
>> --
>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALta04wMbvf3BDh9%2B_7TT_VbnApMt3HfqwD%2B_4qSNBpY2xaUQQ%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>


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

end of thread, other threads:[~2017-10-01 11:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26 16:01 [PATCH v2 00/10] Fix checkpatch issues Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 01/10] Staging: media: atomisp: Use kmalloc_array instead of kmalloc Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 02/10] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
2017-09-29 13:34   ` [Outreachy kernel] " Greg Kroah-Hartman
2017-10-01 11:37     ` Georgiana Chelu
2017-10-01 11:47       ` Julia Lawall
2017-10-01 11:56         ` Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 03/10] Staging: media: atomisp: Remove unlikely from NULL pointer check Georgiana Chelu
2017-09-29 13:35   ` Greg Kroah-Hartman
2017-09-26 16:01 ` [PATCH v2 04/10] Staging: media: atomisp: Adjust checks for null pointers Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 05/10] Staging: media: atomisp: Remove return statement from void function Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 06/10] Staging: media: atomisp: Add spaces around bitwise OR Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 07/10] Staging: media: atomisp: Remove braces {} for single statement blocks Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 08/10] Staging: media: atomisp: Align code with open parenthesis Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 09/10] Staging: media: atomisp: Merge quoted string split across lines Georgiana Chelu
2017-09-26 16:01 ` [PATCH v2 10/10] Staging: media: atomisp: Split lines wiht over 80 characters Georgiana Chelu

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.