summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_imx.c
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:29 +0200
commitdc82bce50b6d7050c8a65682f5ea4078b293f171 (patch)
treec1e76cdabe07c6a789646a5fb9776c1fa5a386ed /drivers/serial/serial_imx.c
parent2fbba4e4d573273034a19703a6d0cbe29c21e418 (diff)
downloadbarebox-dc82bce50b6d7050c8a65682f5ea4078b293f171.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>
Diffstat (limited to 'drivers/serial/serial_imx.c')
-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);