[PATCH 1/2] serial-imx: fix for non of usage

Eric Bénard eric at eukrea.com
Mon Sep 22 15:13:34 PDT 2014


this was broken by :
"3843bfd serial: imx: Determine device name from device tree"

Tested on an i.MX35.

Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 drivers/serial/serial_imx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 474bfaf..e97fd2f 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -338,10 +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);
 
 	/* Enable UART */
@@ -352,7 +353,6 @@ static int imx_serial_probe(struct device_d *dev)
 	console_register(cdev);
 	priv->notify.notifier_call = imx_clocksource_clock_change;
 	clock_register_client(&priv->notify);
-
 	return 0;
 
 err_free:
-- 
1.9.3




More information about the barebox mailing list