At present these state functions raise an exception if they cannot find
what is requested. But in some cases the information is optional (e.g. an
fdtmap in a coming patch) so it is better to return gracefully.
Update these two functions to return None when the data cannot be found.
Signed-off-by: Simon Glass <sjg@chromium.org>
Returns:
Fdt object associated with the entry type
"""
- return output_fdt_files[etype][0]
+ value = output_fdt_files.get(etype);
+ if not value:
+ return None
+ return value[0]
def GetFdtPath(etype):
"""Get the full pathname of a particular Fdt object
pathname to Fdt
Fdt data (as bytes)
"""
- if etype in output_fdt_files and not use_fake_dtb:
+ if etype not in output_fdt_files:
+ return None, None
+ if not use_fake_dtb:
pathname = GetFdtPath(etype)
data = GetFdtForEtype(etype).GetContents()
else: