Skip to contentSkip to conversation

staging: bcm2835-camera: Remove 'ret' variable

PATCH In review Bhanusree Pola 2 participants 3 messages Oct 15, 2018 – Oct 22, 2018 2 messages not in the archive

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

PATCH v3 1/1 staging: bcm2835-camera: Remove 'ret' variable

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;

---

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(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +1 -3
index c04bdf0..a124f51 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Bhanusree Pola

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

Quoted 56 lines

@@
local idexpression ret;
expression e;
@@

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

---

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(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +1 -4
index c04bdf0..a124f51 100644
@@ -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 [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/20181015091720.GA16418%40aakashd-VirtualBox.
For more options, visit https://groups.google.com/d/optout.

A message that is not in the archive (sent off-list or not yet received): CAB0Mk-NUUH-TchghtK5qNG0qgY7HP7hAoavv7Uex6ah-COOh8g@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): CAB0Mk-NQHNrWdxOGoQd+DZVH0oYWXq33aeApvAL1Zrc5DRZwZg@mail.gmail.com

#4 lore raw
Quoted 54 lines · Bhanusree Mahesh
Quoted 51 lines · Bhanusree Mahesh
Quoted 49 lines · Bhanusree Pola

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;
@@

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

---

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(-)
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +1 -3
index c04bdf0..a124f51 100644
@@ -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;
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +0 -1
 #define MAX_SUPPORTED_ENCODINGS 20
--

2.7.4

Any modifications required for this to be accepted?

Bhanusree