summaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-06-16 17:02:15 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 12:01:17 -0700
commit1a2c4b3147ac0645605d6def2855478861d9361b (patch)
tree1efe2b21ce9356f7a0427f18b6ba910ca4134232 /drivers/serial
parent0ccad87012c6c2e7446e4dc0f0894cf182a5270a (diff)
downloadblackbird-op-linux-1a2c4b3147ac0645605d6def2855478861d9361b.tar.gz
blackbird-op-linux-1a2c4b3147ac0645605d6def2855478861d9361b.zip
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.c12
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,
rational_best_approximation(16 * div * baud, sport->port.uartclk,
1 << 16, 1 << 16, &num, &denom);
- tdiv64 = sport->port.uartclk;
- tdiv64 *= num;
- do_div(tdiv64, denom * 16 * div);
- tty_encode_baud_rate(sport->port.info->port.tty,
- (speed_t)tdiv64, (speed_t)tdiv64);
+ if (port->info && port->info->port.tty) {
+ tdiv64 = sport->port.uartclk;
+ tdiv64 *= num;
+ do_div(tdiv64, denom * 16 * div);
+ tty_encode_baud_rate(sport->port.info->port.tty,
+ (speed_t)tdiv64, (speed_t)tdiv64);
+ }
num -= 1;
denom -= 1;
OpenPOWER on IntegriCloud