[U-Boot] [PATCH 2/8] dm: core: remove meaningless if conditional

Masahiro Yamada yamada.m at jp.panasonic.com
Mon Nov 17 09:19:39 CET 2014


If the variable "ret" is equal to "-ENOENT", it is trapped at [1] and
never reaches [2].  At [3], the condition "ret != -ENOENT" is always
true.

  if (ret == -ENOENT) {                       <------------------ [1]
          continue;
  } else if (ret == -ENODEV) {
          dm_dbg("Device '%s' has no compatible string\n", name);
          break;
  } else if (ret) {                           <------------------ [2]
          dm_warn("Device tree error at offset %d\n", offset);
          if (!result || ret != -ENOENT)      <------------------ [3]
                  result = ret;
          break;
  }

Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
---

 drivers/core/lists.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index 3a1ea85..0aad56d 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -136,8 +136,7 @@ int lists_bind_fdt(struct udevice *parent, const void *blob, int offset,
 			break;
 		} else if (ret) {
 			dm_warn("Device tree error at offset %d\n", offset);
-			if (!result || ret != -ENOENT)
-				result = ret;
+			result = ret;
 			break;
 		}
 
-- 
1.9.1



More information about the U-Boot mailing list