diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-06-16 12:02:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 15:01:17 -0400 |
commit | 1a2c4b3147ac0645605d6def2855478861d9361b (patch) | |
tree | 1efe2b21ce9356f7a0427f18b6ba910ca4134232 /drivers/serial | |
parent | 0ccad87012c6c2e7446e4dc0f0894cf182a5270a (diff) |
imx: Check for NULL pointer deref before calling tty_encode_baud_rate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/imx.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 285b414f3054..5d7b58f1fe42 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -924,11 +924,13 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
924 | rational_best_approximation(16 * div * baud, sport->port.uartclk, | 924 | rational_best_approximation(16 * div * baud, sport->port.uartclk, |
925 | 1 << 16, 1 << 16, &num, &denom); | 925 | 1 << 16, 1 << 16, &num, &denom); |
926 | 926 | ||
927 | tdiv64 = sport->port.uartclk; | 927 | if (port->info && port->info->port.tty) { |
928 | tdiv64 *= num; | 928 | tdiv64 = sport->port.uartclk; |
929 | do_div(tdiv64, denom * 16 * div); | 929 | tdiv64 *= num; |
930 | tty_encode_baud_rate(sport->port.info->port.tty, | 930 | do_div(tdiv64, denom * 16 * div); |
931 | (speed_t)tdiv64, (speed_t)tdiv64); | 931 | tty_encode_baud_rate(sport->port.info->port.tty, |
932 | (speed_t)tdiv64, (speed_t)tdiv64); | ||
933 | } | ||
932 | 934 | ||
933 | num -= 1; | 935 | num -= 1; |
934 | denom -= 1; | 936 | denom -= 1; |