linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: v4l2-core: v4l2-dv-timings.c:  Cleaning up code that putting values to the same variable twice
@ 2014-06-07  0:31 Rickard Strandqvist
  2014-06-10 16:35 ` Prabhakar Lad
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-06-07  0:31 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil
  Cc: Rickard Strandqvist, Lad, Prabhakar, Martin Bugge, linux-media,
	linux-kernel

Instead of putting the same variable twice,
was rather intended to set this value to two different variable.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/media/v4l2-core/v4l2-dv-timings.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 48b20df..eb3850c 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -599,10 +599,10 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait)
 		aspect.denominator = 9;
 	} else if (ratio == 34) {
 		aspect.numerator = 4;
-		aspect.numerator = 3;
+		aspect.denominator = 3;
 	} else if (ratio == 68) {
 		aspect.numerator = 15;
-		aspect.numerator = 9;
+		aspect.denominator = 9;
 	} else {
 		aspect.numerator = hor_landscape + 99;
 		aspect.denominator = 100;
-- 
1.7.10.4


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

* Re: [PATCH] media: v4l2-core: v4l2-dv-timings.c: Cleaning up code that putting values to the same variable twice
  2014-06-07  0:31 [PATCH] media: v4l2-core: v4l2-dv-timings.c: Cleaning up code that putting values to the same variable twice Rickard Strandqvist
@ 2014-06-10 16:35 ` Prabhakar Lad
  0 siblings, 0 replies; 2+ messages in thread
From: Prabhakar Lad @ 2014-06-10 16:35 UTC (permalink / raw)
  To: Rickard Strandqvist
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Martin Bugge, linux-media, LKML

Hi Rickard,

Thanks for the patch.

On Sat, Jun 7, 2014 at 1:31 AM, Rickard Strandqvist
<rickard_strandqvist@spectrumdigital.se> wrote:
> Instead of putting the same variable twice,
> was rather intended to set this value to two different variable.
>
> This was partly found using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

The commit message and header needs to be improved, apart from that rest of the
patch looks good.

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

> ---
>  drivers/media/v4l2-core/v4l2-dv-timings.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
> index 48b20df..eb3850c 100644
> --- a/drivers/media/v4l2-core/v4l2-dv-timings.c
> +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
> @@ -599,10 +599,10 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait)
>                 aspect.denominator = 9;
>         } else if (ratio == 34) {
>                 aspect.numerator = 4;
> -               aspect.numerator = 3;
> +               aspect.denominator = 3;
>         } else if (ratio == 68) {
>                 aspect.numerator = 15;
> -               aspect.numerator = 9;
> +               aspect.denominator = 9;
>         } else {
>                 aspect.numerator = hor_landscape + 99;
>                 aspect.denominator = 100;
> --
> 1.7.10.4
>

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

end of thread, other threads:[~2014-06-10 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-07  0:31 [PATCH] media: v4l2-core: v4l2-dv-timings.c: Cleaning up code that putting values to the same variable twice Rickard Strandqvist
2014-06-10 16:35 ` Prabhakar Lad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).