diff mbox

[U-Boot,v2,2/3] spi: ti_qspi: Fix compiler warning when DEBUG macro is set

Message ID 20160722052550.13339-2-vigneshr@ti.com
State Accepted
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Raghavendra, Vignesh July 22, 2016, 5:25 a.m. UTC
clk_div is uninitialized at the beginning of ti_spi_set_speed(), move
debug() print after clk_div calculation to avoid compiler warning and to
have proper value of clk_div printed during debugging.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v2: no change

 drivers/spi/ti_qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jagan Teki July 22, 2016, 8:22 a.m. UTC | #1
On 22 July 2016 at 10:55, Vignesh R <vigneshr@ti.com> wrote:
> clk_div is uninitialized at the beginning of ti_spi_set_speed(), move
> debug() print after clk_div calculation to avoid compiler warning and to
> have proper value of clk_div printed during debugging.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>

Reviewed-by: Jagan Teki <jteki@openedev.com>
Mugunthan V N July 22, 2016, 10:09 a.m. UTC | #2
On Friday 22 July 2016 10:55 AM, Vignesh R wrote:
> clk_div is uninitialized at the beginning of ti_spi_set_speed(), move
> debug() print after clk_div calculation to avoid compiler warning and to
> have proper value of clk_div printed during debugging.
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>

Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N
Jagan Teki July 23, 2016, 4:07 p.m. UTC | #3
On 22 July 2016 at 15:39, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> On Friday 22 July 2016 10:55 AM, Vignesh R wrote:
>> clk_div is uninitialized at the beginning of ti_spi_set_speed(), move
>> debug() print after clk_div calculation to avoid compiler warning and to
>> have proper value of clk_div printed during debugging.
>>
>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>
> Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied to u-boot-spi/master

thanks!
diff mbox

Patch

diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index a850aa26ec2b..56ae29a3ee7c 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -110,13 +110,13 @@  static void ti_spi_set_speed(struct ti_qspi_priv *priv, uint hz)
 {
 	uint clk_div;
 
-	debug("ti_spi_set_speed: hz: %d, clock divider %d\n", hz, clk_div);
-
 	if (!hz)
 		clk_div = 0;
 	else
 		clk_div = (QSPI_FCLK / hz) - 1;
 
+	debug("ti_spi_set_speed: hz: %d, clock divider %d\n", hz, clk_div);
+
 	/* disable SCLK */
 	writel(readl(&priv->base->clk_ctrl) & ~QSPI_CLK_EN,
 	       &priv->base->clk_ctrl);