* [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable
@ 2018-10-21 16:34 Maxime Ripard
2018-10-21 16:34 ` [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation Maxime Ripard
2018-10-24 8:42 ` [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable Giulio Benetti
0 siblings, 2 replies; 5+ messages in thread
From: Maxime Ripard @ 2018-10-21 16:34 UTC (permalink / raw)
To: linux-arm-kernel
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.
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(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
index 3ecffa52c814..cd2348554bac 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
@@ -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;
--
2.19.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation
2018-10-21 16:34 [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable Maxime Ripard
@ 2018-10-21 16:34 ` Maxime Ripard
2018-10-24 8:43 ` Giulio Benetti
2018-10-24 8:42 ` [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable Giulio Benetti
1 sibling, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2018-10-21 16:34 UTC (permalink / raw)
To: linux-arm-kernel
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(-)
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;
}
}
}
--
2.19.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable
2018-10-21 16:34 [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable Maxime Ripard
2018-10-21 16:34 ` [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation Maxime Ripard
@ 2018-10-24 8:42 ` Giulio Benetti
1 sibling, 0 replies; 5+ messages in thread
From: Giulio Benetti @ 2018-10-24 8:42 UTC (permalink / raw)
To: linux-arm-kernel
Il 21/10/2018 18:34, Maxime Ripard ha scritto:
> 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.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.comReviewed-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 3ecffa52c814..cd2348554bac 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> @@ -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;
>
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation
2018-10-21 16:34 ` [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation Maxime Ripard
@ 2018-10-24 8:43 ` Giulio Benetti
2018-10-29 13:22 ` Maxime Ripard
0 siblings, 1 reply; 5+ messages in thread
From: Giulio Benetti @ 2018-10-24 8:43 UTC (permalink / raw)
To: linux-arm-kernel
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;
> }
> }
> }
>
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation
2018-10-24 8:43 ` Giulio Benetti
@ 2018-10-29 13:22 ` Maxime Ripard
0 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2018-10-29 13:22 UTC (permalink / raw)
To: linux-arm-kernel
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
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-10-29 13:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-21 16:34 [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable Maxime Ripard
2018-10-21 16:34 ` [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation Maxime Ripard
2018-10-24 8:43 ` Giulio Benetti
2018-10-29 13:22 ` Maxime Ripard
2018-10-24 8:42 ` [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable Giulio Benetti
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).