scripts/dts/edtlib.py: Hoist enum checking before early out

Move the enum checking before we early out for '#' and '-map' properties
so they can benefit from it.  Also make the error messages for failed
'enum' check more informative by including the paths to the .dts file
and the binding for the node.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
diff --git a/scripts/dts/edtlib.py b/scripts/dts/edtlib.py
index e3442f6..4c35511 100644
--- a/scripts/dts/edtlib.py
+++ b/scripts/dts/edtlib.py
@@ -545,6 +545,13 @@
             # 'category: optional' property that wasn't there
             return
 
+        enum = options.get("enum")
+        if enum and val not in enum:
+            _err("value of property '{}' on {} in {} ({!r}) is not in 'enum' "
+                 "list in {} ({!r})"
+                 .format(name, self.path, self.edt.dts_path, val,
+                         self.binding_path, enum))
+
         # Skip properties that start with '#', like '#size-cells', and mapping
         # properties like 'gpio-map'/'interrupt-map'
         if name[0] == "#" or name.endswith("-map"):
@@ -557,15 +564,7 @@
         if prop.description:
             prop.description = prop.description.rstrip()
         prop.val = val
-        enum = options.get("enum")
-        if enum is None:
-            prop.enum_index = None
-        else:
-            if val not in enum:
-                _err("value ({}) for property ({}) is not in enumerated "
-                     "list {} for node {}".format(val, name, enum, self.name))
-
-            prop.enum_index = enum.index(val)
+        prop.enum_index = None if enum is None else enum.index(val)
 
         self.props[name] = prop