staging: vc04_services: bcm2835-camera: Remove unnecessary variable
Subsystems (3)
PATCH 1/1 staging: vc04_services: bcm2835-camera: Remove unnecessary variable
Instead of using the ret variable, return 0 directly
--- drivers/staging/vc04_services/bcm2835-camera/controls.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/controls.c +4 -6
@@ -609,18 +609,16 @@ static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev,struct v4l2_ctrl *ctrl, const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) { - int ret; struct vchiq_mmal_port *encoder_out; dev->capture.encode_bitrate = ctrl->val; encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE ]->output[0 ]; - ret =vchiq_mmal_port_parameter_set (dev->instance, encoder_out, - mmal_ctrl->mmal_id, - &ctrl->val,sizeof (ctrl->val)); - ret =0 ; -return ret; +vchiq_mmal_port_parameter_set (dev->instance, encoder_out, + mmal_ctrl->mmal_id, + &ctrl->val,sizeof (ctrl->val)); +return 0 ; } static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev,
Signature · 1 line
1.9.1
Quoted 1 line · Narcisa Ana Maria Vasile
Instead of using the ret variable, return 0 directly
I think you should say a little more, because you are also removing an assignment where the assigned variable is not used. You could also take a look at vchiq_mmal_port_parameter_set to see why the return value is not important.
julia
Quoted 43 lines
Signed-off-by Narcisa Ana Maria Vasile <[email protected]>--- drivers/staging/vc04_services/bcm2835-camera/controls.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/staging/vc04_services/bcm2835-camera/controls.c +4
-7@@ -609,18 +609,16 @@ static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev,struct v4l2_ctrl *ctrl, const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) { - int ret; struct vchiq_mmal_port *encoder_out; dev->capture.encode_bitrate = ctrl->val; encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE ]->output[0 ]; - ret =vchiq_mmal_port_parameter_set (dev->instance, encoder_out, - mmal_ctrl->mmal_id, - &ctrl->val,sizeof (ctrl->val)); - ret =0 ; -return ret; +vchiq_mmal_port_parameter_set (dev->instance, encoder_out, + mmal_ctrl->mmal_id, + &ctrl->val,sizeof (ctrl->val)); +return 0 ; } static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev, --1.9.1
--
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/1488467703-15980-1-git-send-email-narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 11 lines · Julia Lawall
Quoted 1 line · Narcisa Ana Maria Vasile
Instead of using the ret variable, return 0 directly
I think you should say a little more, because you are also removing an assignment where the assigned variable is not used. You could also take a look at
vchiq_mmal_port_parameter_setto see why the return value is not important.julia
I looked at the code, but I can't say for sure why the return value is
0. It seems to me that it should return the value
returned by vchiq_mmal_port_parameter_set. As I'm not sure that this is correct, I didn't want to modify it this way. Perhaps someone who worked on the code can tell for sure?
Narcisa
Quoted 43 lines
Quoted 43 lines
Signed-off-by Narcisa Ana Maria Vasile <[email protected]>--- drivers/staging/vc04_services/bcm2835-camera/controls.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/staging/vc04_services/bcm2835-camera/controls.c +4
-7@@ -609,18 +609,16 @@ static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev,struct v4l2_ctrl *ctrl, const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) { - int ret; struct vchiq_mmal_port *encoder_out; dev->capture.encode_bitrate = ctrl->val; encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE ]->output[0 ]; - ret =vchiq_mmal_port_parameter_set (dev->instance, encoder_out, - mmal_ctrl->mmal_id, - &ctrl->val,sizeof (ctrl->val)); - ret =0 ; -return ret; +vchiq_mmal_port_parameter_set (dev->instance, encoder_out, + mmal_ctrl->mmal_id, + &ctrl->val,sizeof (ctrl->val)); +return 0 ; } static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev, --1.9.1
--
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/1488467703-15980-1-git-send-email-narcisaanamaria12%40gmail.com.
For more options, visit https://groups.google.com/d/optout.