All of lore.kernel.org
 help / color / mirror / Atom feed
* [Outreachy kernel][PATCH v3] staging: bcm2835-camera: Remove 'ret' variable
@ 2018-10-15  9:17 Bhanusree Pola
  2018-10-15  9:46 ` Julia Lawall
       [not found] ` <CAB0Mk-NUUH-TchghtK5qNG0qgY7HP7hAoavv7Uex6ah-COOh8g@mail.gmail.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Bhanusree Pola @ 2018-10-15  9:17 UTC (permalink / raw)
  To: outreachy-kernel
  Cc: Eric Anholt, Stefan Wahren, Greg Kroah-Hartman, Florian Fainelli,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list, bhanusreemahesh

Return value to be returned without using extra variable 'ret'.
Removed the useless variable 'ret' by hand using coccinelle semantic patch ret.cocci
The following is the ret.cocci semantic patch used:

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
---

changelog:

v2: Include semantic patch used in the commit message
v3: Modified Commit message

 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index c04bdf0..a124f51 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -1510,7 +1510,6 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
 				 struct vchiq_mmal_component *camera,
 				 struct bm2835_mmal_dev *dev)
 {
-	int ret;
 	struct mmal_parameter_camera_config cam_config = {
 		.max_stills_w = dev->max_width,
 		.max_stills_h = dev->max_height,
@@ -1526,10 +1525,9 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
 		.use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC
 	};
 
-	ret = vchiq_mmal_port_parameter_set(instance, &camera->control,
+	return vchiq_mmal_port_parameter_set(instance, &camera->control,
 					    MMAL_PARAMETER_CAMERA_CONFIG,
 					    &cam_config, sizeof(cam_config));
-	return ret;
 }
 
 #define MAX_SUPPORTED_ENCODINGS 20
-- 
2.7.4



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

* Re: [Outreachy kernel][PATCH v3] staging: bcm2835-camera: Remove 'ret' variable
  2018-10-15  9:17 [Outreachy kernel][PATCH v3] staging: bcm2835-camera: Remove 'ret' variable Bhanusree Pola
@ 2018-10-15  9:46 ` Julia Lawall
       [not found] ` <CAB0Mk-NUUH-TchghtK5qNG0qgY7HP7hAoavv7Uex6ah-COOh8g@mail.gmail.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2018-10-15  9:46 UTC (permalink / raw)
  To: Bhanusree Pola
  Cc: outreachy-kernel, Eric Anholt, Stefan Wahren, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list



On Mon, 15 Oct 2018, Bhanusree Pola wrote:

> Return value to be returned without using extra variable 'ret'.
> Removed the useless variable 'ret' by hand using coccinelle semantic patch ret.cocci
> The following is the ret.cocci semantic patch used:

Sorry to be endlessly picky, but Coccinelle removed the uses of the
variable, and you removed the declaration of the variable by hand.  If one
looks at your semantic patch, one doesn't see anything that removes int
ret.

julia

>
> @@
> local idexpression ret;
> expression e;
> @@
>
> -ret =
> +return
>      e;
> -return ret;
>
> Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
> ---
>
> changelog:
>
> v2: Include semantic patch used in the commit message
> v3: Modified Commit message
>
>  drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> index c04bdf0..a124f51 100644
> --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> @@ -1510,7 +1510,6 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
>  				 struct vchiq_mmal_component *camera,
>  				 struct bm2835_mmal_dev *dev)
>  {
> -	int ret;
>  	struct mmal_parameter_camera_config cam_config = {
>  		.max_stills_w = dev->max_width,
>  		.max_stills_h = dev->max_height,
> @@ -1526,10 +1525,9 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
>  		.use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC
>  	};
>
> -	ret = vchiq_mmal_port_parameter_set(instance, &camera->control,
> +	return vchiq_mmal_port_parameter_set(instance, &camera->control,
>  					    MMAL_PARAMETER_CAMERA_CONFIG,
>  					    &cam_config, sizeof(cam_config));
> -	return ret;
>  }
>
>  #define MAX_SUPPORTED_ENCODINGS 20
> --
> 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/20181015091720.GA16418%40aakashd-VirtualBox.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel][PATCH v3] staging: bcm2835-camera: Remove 'ret' variable
       [not found]   ` <CAB0Mk-NQHNrWdxOGoQd+DZVH0oYWXq33aeApvAL1Zrc5DRZwZg@mail.gmail.com>
@ 2018-10-22  5:04     ` Bhanusree Mahesh
  0 siblings, 0 replies; 3+ messages in thread
From: Bhanusree Mahesh @ 2018-10-22  5:04 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Greg Kroah-Hartman

On Mon, 22 Oct 2018 at 10:31, Bhanusree Mahesh
<bhanusreemahesh@gmail.com> wrote:
>
> On Mon, 22 Oct 2018 at 10:26, Bhanusree Mahesh
> <bhanusreemahesh@gmail.com> wrote:
> >
> > On Mon, 15 Oct 2018 at 14:48, Bhanusree Pola <bhanusreemahesh@gmail.com> wrote:
> > >
> > > Return value to be returned without using extra variable 'ret'.
> > > Removed the useless variable 'ret' by hand using coccinelle semantic patch ret.cocci
> > > The following is the ret.cocci semantic patch used:
> > >
> > > @@
> > > local idexpression ret;
> > > expression e;
> > > @@
> > >
> > > -ret =
> > > +return
> > >      e;
> > > -return ret;
> > >
> > > Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
> > > ---
> > >
> > > changelog:
> > >
> > > v2: Include semantic patch used in the commit message
> > > v3: Modified Commit message
> > >
> > >  drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> > > index c04bdf0..a124f51 100644
> > > --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> > > +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> > > @@ -1510,7 +1510,6 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
> > >                                  struct vchiq_mmal_component *camera,
> > >                                  struct bm2835_mmal_dev *dev)
> > >  {
> > > -       int ret;
> > >         struct mmal_parameter_camera_config cam_config = {
> > >                 .max_stills_w = dev->max_width,
> > >                 .max_stills_h = dev->max_height,
> > > @@ -1526,10 +1525,9 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
> > >                 .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC
> > >         };
> > >
> > > -       ret = vchiq_mmal_port_parameter_set(instance, &camera->control,
> > > +       return vchiq_mmal_port_parameter_set(instance, &camera->control,
> > >                                             MMAL_PARAMETER_CAMERA_CONFIG,
> > >                                             &cam_config, sizeof(cam_config));
> > > -       return ret;
> > >  }
> > >
> > >  #define MAX_SUPPORTED_ENCODINGS 20
> > > --
> > > 2.7.4
> > >
Any modifications required for this to be accepted?


 Bhanusree


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

end of thread, other threads:[~2018-10-22  5:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-15  9:17 [Outreachy kernel][PATCH v3] staging: bcm2835-camera: Remove 'ret' variable Bhanusree Pola
2018-10-15  9:46 ` Julia Lawall
     [not found] ` <CAB0Mk-NUUH-TchghtK5qNG0qgY7HP7hAoavv7Uex6ah-COOh8g@mail.gmail.com>
     [not found]   ` <CAB0Mk-NQHNrWdxOGoQd+DZVH0oYWXq33aeApvAL1Zrc5DRZwZg@mail.gmail.com>
2018-10-22  5:04     ` Bhanusree Mahesh

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.