From 299bfd0553b6e8ac1b63bbf8d54c08da332f91c2 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 25 Mar 2020 15:32:58 -0500 Subject: [PATCH] scripts: dts: gen_defines: Fix issue if there are no compats We get the following error: ValueError: max() arg is an empty sequence if the compatiable section of the device tree is empty or doesn't exist. Fix this by havingin max_len get a default value of 0. Signed-off-by: Kumar Gala --- scripts/dts/gen_defines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index ac46b18351f..6b86ec5b6e6 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -505,7 +505,7 @@ def write_chosen(edt): for name, node in edt.chosen_nodes.items(): chosen[f"DT_CHOSEN_{str2ident(name)}"] = f"DT_{node.z_path_id}" chosen[f"DT_CHOSEN_{str2ident(name)}_EXISTS"] = 1 - max_len = max(map(len, chosen)) + max_len = max(map(len, chosen), default=0) for macro, value in chosen.items(): out_define(macro, value, width=max_len)