drm/sun4i: hdmi: Fix unitialized variable
PATCH 1/2 drm/sun4i: hdmi: Fix unitialized variable
The is_double variable is used to store, and possibly returning to the calling function, whether it needs to double the rate of the parent clock or not.
In the case where it does, the variable is affected, but in the case where it doesn't we return some uninitialized value. Fix this.
--- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +1 -1
@@ -35,7 +35,7 @@ static unsigned long sun4i_tmds_calc_divider(unsigned long rate, {unsigned long best_rate =0 ;u8 best_m =0 , m; -bool is_double; +bool is_double = false;for (m = div_offset ?:1 ; m < (16 + div_offset); m++) {u8 d;
Signature · 1 line
2.19.1
PATCH 2/2 drm/sun4i: hdmi: Fix double flag assignation
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.
--- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +1 -1
@@ -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; } } }
Signature · 1 line
2.19.1
Re: [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation
Il 21/10/2018 18:34, Maxime Ripard ha scritto:
Quoted 10 lines
The
is_doubleflag is a boolean currently assigned to the value of the d variable, that is either 1 or 2. It means that thisis_doublevariable 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 <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +1
-1@@ -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; } } }
Signature · 14 lines
Giulio Benetti CTO MICRONOVA SRL Sede: Via A. Niedda 3 - 35010 Vigonza (PD) Tel. 049/8931563 - Fax 049/8931346 Cod.Fiscale - P.IVA 02663420285 Capitale Sociale € 26.000 i.v. Iscritta al Reg. Imprese di Padova N. 02663420285 Numero R.E.A. 258642 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maxime Ripard
AppliedRe: [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation
Quoted 6 lines · Giulio Benetti
Il 21/10/2018 18:34, Maxime Ripard ha scritto:
Quoted 5 lines
The
is_doubleflag is a boolean currently assigned to the value of the d variable, that is either 1 or 2. It means that thisis_doublevariable is always set to true, even though the initial intent was to have it set to true when d is 2.
Quoted 7 lines
Quoted 5 lines
Fix this.
Fixes 9c5681011a0c ("drm/sun4i: Add HDMI support")Reported-by Dan Carpenter <[email protected]>Signed-off-by Maxime Ripard <[email protected]>Reviewed-by Giulio Benetti <[email protected]>
Applied both, thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 228 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181029/abda975c/attachment.sig>
Il 21/10/2018 18:34, Maxime Ripard ha scritto:
Quoted 28 lines
The
is_doublevariable is used to store, and possibly returning to the calling function, whether it needs to double the rate of the parent clock or not.In the case where it does, the variable is affected, but in the case where it doesn't we return some uninitialized value. Fix this.
Reported-by Dan Carpenter <[email protected]>Signed-off-by Maxime Ripard <[email protected]: Giulio Benetti <[email protected]>--- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +1
-1@@ -35,7 +35,7 @@ static unsigned long sun4i_tmds_calc_divider(unsigned long rate, {unsigned long best_rate =0 ;u8 best_m =0 , m; -bool is_double; +bool is_double = false;for (m = div_offset ?:1 ; m < (16 + div_offset); m++) {u8 d;
Signature · 14 lines
Giulio Benetti CTO MICRONOVA SRL Sede: Via A. Niedda 3 - 35010 Vigonza (PD) Tel. 049/8931563 - Fax 049/8931346 Cod.Fiscale - P.IVA 02663420285 Capitale Sociale € 26.000 i.v. Iscritta al Reg. Imprese di Padova N. 02663420285 Numero R.E.A. 258642 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel