2019-04-19 21:26:00

by Madhumitha Prabakaran

[permalink] [raw]
Subject: [PATCH] Staging: vc04_services: Cleanup in ctrl_set_bitrate()

Remove unnecessary variable and replace return type.

Issue suggested by Coccinelle.

Signed-off-by: Madhumitha Prabakaran <[email protected]>
---
drivers/staging/vc04_services/bcm2835-camera/controls.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
index e39ab5fae724..f87fa7f61db3 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
@@ -607,18 +607,13 @@ 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;
+ return 0;
}

static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev,
--
2.17.1



2019-04-19 21:52:29

by Stefan Wahren

[permalink] [raw]
Subject: Re: [PATCH] Staging: vc04_services: Cleanup in ctrl_set_bitrate()

Hi Madhumitha,

Am 19.04.19 um 23:23 schrieb Madhumitha Prabakaran:
> Remove unnecessary variable and replace return type.
>
> Issue suggested by Coccinelle.
>
> Signed-off-by: Madhumitha Prabakaran <[email protected]>
> ---
> drivers/staging/vc04_services/bcm2835-camera/controls.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> index e39ab5fae724..f87fa7f61db3 100644
> --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
> +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> @@ -607,18 +607,13 @@ 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;
> + return 0;

i don't understand why we can remove here the function call.

Stefan

> }
>
> static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev,

2019-04-20 03:15:00

by Madhumitha Prabakaran

[permalink] [raw]
Subject: Re: [PATCH] Staging: vc04_services: Cleanup in ctrl_set_bitrate()

On 04/19 :49, Stefan Wahren wrote:
> Hi Madhumitha,
>
> Am 19.04.19 um 23:23 schrieb Madhumitha Prabakaran:
> > Remove unnecessary variable and replace return type.
> >
> > Issue suggested by Coccinelle.
> >
> > Signed-off-by: Madhumitha Prabakaran <[email protected]>
> > ---
> > drivers/staging/vc04_services/bcm2835-camera/controls.c | 7 +------
> > 1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> > index e39ab5fae724..f87fa7f61db3 100644
> > --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
> > +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
> > @@ -607,18 +607,13 @@ 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;
> > + return 0;
>
> i don't understand why we can remove here the function call.

I overlooked the function call. I will fix it.

>
> Stefan
>
> > }
> >
> > static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev,