* [PATCH] staging: vc04_services: bcm2835-camera: Remove unnecessary variable
@ 2017-03-02 15:15 Narcisa Ana Maria Vasile
2017-03-02 15:17 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-02 15:15 UTC (permalink / raw)
To: swarren, lee, eric, gregkh, f.fainelli, rjui, sbranden
Cc: outreachy-kernel, Narcisa Ana Maria Vasile
Instead of using the ret variable, return 0 directly
Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
drivers/staging/vc04_services/bcm2835-camera/controls.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
index 9c0667e..7bdde87 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: vc04_services: bcm2835-camera: Remove unnecessary variable
2017-03-02 15:15 [PATCH] staging: vc04_services: bcm2835-camera: Remove unnecessary variable Narcisa Ana Maria Vasile
@ 2017-03-02 15:17 ` Julia Lawall
2017-03-03 10:44 ` Narcisa Ana Maria Vasile
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2017-03-02 15:17 UTC (permalink / raw)
To: Narcisa Ana Maria Vasile
Cc: swarren, lee, eric, gregkh, f.fainelli, rjui, sbranden, outreachy-kernel
On Thu, 2 Mar 2017, Narcisa Ana Maria Vasile wrote:
> 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
>
> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
> ---
> drivers/staging/vc04_services/bcm2835-camera/controls.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> index 9c0667e..7bdde87 100644
> --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
> +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> @@ -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 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/1488467703-15980-1-git-send-email-narcisaanamaria12%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: vc04_services: bcm2835-camera: Remove unnecessary variable
2017-03-02 15:17 ` [Outreachy kernel] " Julia Lawall
@ 2017-03-03 10:44 ` Narcisa Ana Maria Vasile
0 siblings, 0 replies; 3+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-03 10:44 UTC (permalink / raw)
To: Julia Lawall
Cc: swarren, lee, eric, gregkh, f.fainelli, rjui, sbranden, outreachy-kernel
On Thu, Mar 02, 2017 at 04:17:59PM +0100, Julia Lawall wrote:
> On Thu, 2 Mar 2017, Narcisa Ana Maria Vasile wrote:
>
> > 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
>
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
> >
> > Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
> > ---
> > drivers/staging/vc04_services/bcm2835-camera/controls.c | 10 ++++------
> > 1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> > index 9c0667e..7bdde87 100644
> > --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
> > +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> > @@ -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 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/1488467703-15980-1-git-send-email-narcisaanamaria12%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-03 10:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 15:15 [PATCH] staging: vc04_services: bcm2835-camera: Remove unnecessary variable Narcisa Ana Maria Vasile
2017-03-02 15:17 ` [Outreachy kernel] " Julia Lawall
2017-03-03 10:44 ` Narcisa Ana Maria Vasile
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.