From f0f932d620ffc8b5a93fb457efbcfb3c0a7444f2 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 24 Apr 2015 17:28:40 +0900 Subject: [PATCH 1/3] dm: core: drop device removal error path correctly Trivial bug fix for commit 5a87c4174d18 (dm: core: Drop device removal error path when not supported). Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- drivers/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index 3b77d231d3..85fd1fc735 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -135,7 +135,7 @@ int device_bind(struct udevice *parent, const struct driver *drv, return 0; fail_child_post_bind: - if (IS_ENABLED(DM_DEVICE_REMOVE)) { + if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) { if (drv->unbind && drv->unbind(dev)) { dm_warn("unbind() method failed on dev '%s' on error path\n", dev->name); @@ -143,14 +143,14 @@ fail_child_post_bind: } fail_bind: - if (IS_ENABLED(DM_DEVICE_REMOVE)) { + if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) { if (uclass_unbind_device(dev)) { dm_warn("Failed to unbind dev '%s' on error path\n", dev->name); } } fail_uclass_bind: - if (IS_ENABLED(DM_DEVICE_REMOVE)) { + if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) { list_del(&dev->sibling_node); if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { free(dev->parent_platdata); From 4f60166c909f40da6aee14b810806dfa9f553bbc Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 25 Apr 2015 10:53:14 +0800 Subject: [PATCH 2/3] serial: ns16550: Remove hard-coded baud_divisor setting This was accidentally added by commit dd0b0122bacc "serial: ns16550: Add an option to specify the debug UART register shift". Remove it. Signed-off-by: Axel Lin Acked-by: Simon Glass --- drivers/serial/ns16550.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index fd110b3ddc..3d376d7580 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -255,7 +255,6 @@ void debug_uart_init(void) */ baud_divisor = calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE); - baud_divisor = 13; serial_out_shift(&com_port->ier, CONFIG_DEBUG_UART_SHIFT, CONFIG_SYS_NS16550_IER); serial_out_shift(&com_port->mcr, CONFIG_DEBUG_UART_SHIFT, UART_MCRVAL); From f66529f998e59acbd64ccce3adfce8eedfa52da8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 24 Apr 2015 22:33:07 -0600 Subject: [PATCH 3/3] dm: core: Correct bug introduced in uclass_first/next_device() These functions now rely on uclass_find_first/next_device() and assume that they will either return failure (-ve error code) or a device. In fact, coming to the end of a list is not considered failure and they return 0 in that case. The logic to deal with this was replaced in commit acb9ca2a with just using uclass_get_device_tail(). Add back the missing logic. This bug was caught by unit tests but since they were broken for other reasons at the time, this was not noticed. Signed-off-by: Simon Glass --- drivers/core/uclass.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 04e939d6c1..7de817324b 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -277,6 +277,7 @@ int uclass_get_device_tail(struct udevice *dev, int ret, if (ret) return ret; + assert(dev); ret = device_probe(dev); if (ret) return ret; @@ -342,6 +343,8 @@ int uclass_first_device(enum uclass_id id, struct udevice **devp) *devp = NULL; ret = uclass_find_first_device(id, &dev); + if (!dev) + return 0; return uclass_get_device_tail(dev, ret, devp); } @@ -352,6 +355,8 @@ int uclass_next_device(struct udevice **devp) *devp = NULL; ret = uclass_find_next_device(&dev); + if (!dev) + return 0; return uclass_get_device_tail(dev, ret, devp); }