Skip to contentSkip to conversation

Staging: media: atomisp: Merge assignment with return

PATCH In review Srishti Sharma 3 participants 3 messages Sep 12, 2017 – Sep 18, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: media: atomisp: Merge assignment with return

Merge the assignment and the return statements to return the value directly. Done using the following semantic patch by coccinelle.

@@
local idexpression ret;
expression e;
@@

-ret =
+return

     e;

-return ret;

---
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +1 -5
index 11162f5..e6ddfbf 100644
@@ -1168,13 +1168,9 @@ void hmm_bo_free_pages(struct hmm_buffer_object *bo)
 
 int hmm_bo_page_allocated(struct hmm_buffer_object *bo)
 {
-	int ret;
-
 	check_bo_null_return(bo, 0);
 
-	ret = bo->status & HMM_BO_PAGE_ALLOCED;
-
-	return ret;
+	return bo->status & HMM_BO_PAGE_ALLOCED;
 }
 
 /*
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Srishti Sharma

Merge the assignment and the return statements to return the value directly. Done using the following semantic patch by coccinelle.

@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;
Quoted 1 line
Quoted 33 lines
---
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +1 -6
index 11162f5..e6ddfbf 100644
@@ -1168,13 +1168,9 @@ void hmm_bo_free_pages(struct hmm_buffer_object *bo)
 
 int hmm_bo_page_allocated(struct hmm_buffer_object *bo)
 {
-	int ret;
-
 	check_bo_null_return(bo, 0);
 
-	ret = bo->status & HMM_BO_PAGE_ALLOCED;
-
-	return ret;
+	return bo->status & HMM_BO_PAGE_ALLOCED;
 }
 
 /*
--

2.7.4

--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1505226307-5119-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
In reply to Srishti Sharma
Quoted 13 lines · Srishti Sharma

Merge the assignment and the return statements to return the value directly. Done using the following semantic patch by coccinelle.

@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;
Quoted 1 line

Hi Srishti,

I've merged the two patches as they're trivial and the commit message is the same.

It's entirely reasonable to have a patch per driver but you should mention that in the commit message (subject line) at least. This case is a bit special because the other driver is also specific to the atomisp staging driver.

Thanks.

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]