summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2014-08-15 11:10:03 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-09-05 07:43:55 +0200
commita9d764acabde404df984e6e6aab3452b290d7bd0 (patch)
tree35842e8a72b28d3905f09cb18aa5315ea86b66ce
parent1202e6e83cb238bcfc15ed09272f62b0643cfc4f (diff)
downloadbarebox-a9d764acabde404df984e6e6aab3452b290d7bd0.tar.gz
serial: imx: Fix for non-devicetree boards
Commit 3843bfd0ab77eaf125ca617922927b61fc8ded74 "serial: imx: Determine device name from device tree" broke this driver for non-devicetree boards, since of_alias_get may not be called with a NULL pointer as first argument. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/serial/serial_imx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 474bfaf..e379f29 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -338,9 +338,11 @@ static int imx_serial_probe(struct device_d *dev)
cdev->flush = imx_serial_flush;
cdev->setbrg = imx_serial_setbaudrate;
cdev->linux_console_name = "ttymxc";
- devname = of_alias_get(dev->device_node);
- if (devname)
- cdev->devname = xstrdup(devname);
+ if (dev->device_node) {
+ devname = of_alias_get(dev->device_node);
+ if (devname)
+ cdev->devname = xstrdup(devname);
+ }
imx_serial_init_port(cdev);