Skip to content

Commit

Permalink
serial: sh-sci: Initialise variables before access in sci_set_termios()
Browse files Browse the repository at this point in the history
This change addresses two warnings that are flagged by gcc relating to
potential access to the ssr and cks variables while they are uninitialised.

I have addressed this by initialising the values to
the defaults present in sci_baud_calc_hscif().

It is my analysis that cks is always initialised if used
but that without this change ssr may be accessed while uninitialised.

The code altered by this patch was introduced by commit
f303b36 ("serial: sh-sci: HSCIF support").

Reported-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
  • Loading branch information
Simon Horman committed Jun 26, 2013
1 parent c972f02 commit d4759de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/tty/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1887,9 +1887,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
{
struct sci_port *s = to_sci_port(port);
struct plat_sci_reg *reg;
unsigned int baud, smr_val, max_baud, cks;
unsigned int baud, smr_val, max_baud, cks = 0;
int t = -1;
unsigned int srr;
unsigned int srr = 15;

/*
* earlyprintk comes here early on with port->uartclk set to zero.
Expand Down

0 comments on commit d4759de

Please sign in to comment.