linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Staging: media: atomisp: Merge assignment with return
@ 2017-09-12 14:25 Srishti Sharma
  2017-09-12 14:27 ` [Outreachy kernel] " Julia Lawall
  2017-09-18 11:44 ` Sakari Ailus
  0 siblings, 2 replies; 4+ messages in thread
From: Srishti Sharma @ 2017-09-12 14:25 UTC (permalink / raw)
  To: mchehab
  Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel,
	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;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 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..e6ddfbf 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -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

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

* Re: [Outreachy kernel] [PATCH] Staging: media: atomisp: Merge assignment with return
  2017-09-12 14:25 [PATCH] Staging: media: atomisp: Merge assignment with return Srishti Sharma
@ 2017-09-12 14:27 ` Julia Lawall
  2017-09-18 11:44 ` Sakari Ailus
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-09-12 14:27 UTC (permalink / raw)
  To: Srishti Sharma
  Cc: mchehab, gregkh, linux-media, devel, linux-kernel, outreachy-kernel



On Tue, 12 Sep 2017, Srishti Sharma wrote:

> 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;
>
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>


> ---
>  drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 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..e6ddfbf 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
> @@ -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 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/1505226307-5119-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

* Re: [PATCH] Staging: media: atomisp: Merge assignment with return
  2017-09-12 14:25 [PATCH] Staging: media: atomisp: Merge assignment with return Srishti Sharma
  2017-09-12 14:27 ` [Outreachy kernel] " Julia Lawall
@ 2017-09-18 11:44 ` Sakari Ailus
  1 sibling, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2017-09-18 11:44 UTC (permalink / raw)
  To: Srishti Sharma
  Cc: mchehab, gregkh, linux-media, devel, linux-kernel, outreachy-kernel

On Tue, Sep 12, 2017 at 07:55:07PM +0530, Srishti Sharma wrote:
> 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;
> 
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>

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.

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi

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

* [PATCH] Staging: media: atomisp: Merge assignment with return
@ 2017-09-12 14:12 Srishti Sharma
  0 siblings, 0 replies; 4+ messages in thread
From: Srishti Sharma @ 2017-09-12 14:12 UTC (permalink / raw)
  To: mchehab
  Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel,
	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;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
 drivers/staging/media/atomisp/i2c/ov5693/ov5693.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c
index 1236425..2195011 100644
--- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c
+++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c
@@ -945,12 +945,8 @@ static int ad5823_t_focus_vcm(struct v4l2_subdev *sd, u16 val)
 
 int ad5823_t_focus_abs(struct v4l2_subdev *sd, s32 value)
 {
-	int ret;
-
 	value = min(value, AD5823_MAX_FOCUS_POS);
-	ret = ad5823_t_focus_vcm(sd, value);
-
-	return ret;
+	return ad5823_t_focus_vcm(sd, value);
 }
 
 static int ov5693_t_focus_abs(struct v4l2_subdev *sd, s32 value)
@@ -1332,7 +1328,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag)
 
 static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
 {
-	int ret;
 	struct ov5693_device *dev = to_ov5693_sensor(sd);
 
 	if (!dev || !dev->platform_data)
@@ -1342,9 +1337,7 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
 	if (dev->platform_data->gpio_ctrl)
 		return dev->platform_data->gpio_ctrl(sd, flag);
 
-	ret = dev->platform_data->gpio0_ctrl(sd, flag);
-
-	return ret;
+	return dev->platform_data->gpio0_ctrl(sd, flag);
 }
 
 static int __power_up(struct v4l2_subdev *sd)
-- 
2.7.4

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

end of thread, other threads:[~2017-09-18 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12 14:25 [PATCH] Staging: media: atomisp: Merge assignment with return Srishti Sharma
2017-09-12 14:27 ` [Outreachy kernel] " Julia Lawall
2017-09-18 11:44 ` Sakari Ailus
  -- strict thread matches above, loose matches on Subject: below --
2017-09-12 14:12 Srishti Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).