diff mbox series

[2/2] drm/sun4i: hdmi: Fix double flag assignation

Message ID 20181021163446.29135-2-maxime.ripard@bootlin.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/sun4i: hdmi: Fix unitialized variable | expand

Commit Message

Maxime Ripard Oct. 21, 2018, 4:34 p.m. UTC
The is_double flag is a boolean currently assigned to the value of the d
variable, that is either 1 or 2. It means that this is_double variable is
always set to true, even though the initial intent was to have it set to
true when d is 2.

Fix this.

Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Giulio Benetti Oct. 24, 2018, 8:43 a.m. UTC | #1
Il 21/10/2018 18:34, Maxime Ripard ha scritto:
> The is_double flag is a boolean currently assigned to the value of the d
> variable, that is either 1 or 2. It means that this is_double variable is
> always set to true, even though the initial intent was to have it set to
> true when d is 2.
> 
> Fix this.
> 
> Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

Reviewed-by: Giulio Benetti <giulio.benetti@micronovasrl.com>

> ---
>   drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> index cd2348554bac..fb985ba1a176 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> @@ -52,7 +52,7 @@ static unsigned long sun4i_tmds_calc_divider(unsigned long rate,
>   			    (rate - tmp_rate) < (rate - best_rate)) {
>   				best_rate = tmp_rate;
>   				best_m = m;
> -				is_double = d;
> +				is_double = (d == 2) ? true : false;
>   			}
>   		}
>   	}
>
Maxime Ripard Oct. 29, 2018, 1:22 p.m. UTC | #2
On Wed, Oct 24, 2018 at 10:43:34AM +0200, Giulio Benetti wrote:
> Il 21/10/2018 18:34, Maxime Ripard ha scritto:
> > The is_double flag is a boolean currently assigned to the value of the d
> > variable, that is either 1 or 2. It means that this is_double variable is
> > always set to true, even though the initial intent was to have it set to
> > true when d is 2.
> > 
> > Fix this.
> > 
> > Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support")
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> 
> Reviewed-by: Giulio Benetti <giulio.benetti@micronovasrl.com>

Applied both, thanks!
Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
index cd2348554bac..fb985ba1a176 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
@@ -52,7 +52,7 @@  static unsigned long sun4i_tmds_calc_divider(unsigned long rate,
 			    (rate - tmp_rate) < (rate - best_rate)) {
 				best_rate = tmp_rate;
 				best_m = m;
-				is_double = d;
+				is_double = (d == 2) ? true : false;
 			}
 		}
 	}