pmaports/device/testing/linux-samsung-hero2lte/02-fix-dtbtool.patch
Oliver Smith 64035ac463
device/*: move to device/testing/* (!1063)
Prepare for better device categorization by moving everything to testing
subdir first.

[skip-ci]: chicken-egg problem: passing pmaports CI depends on pmbootstrap MR
				depends on this MR

Related: postmarketos#16
2020-03-14 08:35:32 +01:00

31 lines
1.2 KiB
Diff

Exynos devices have a special device tree image format, which the built in
script in this kernel source facilitates.
Unfortunately, the script is badly written in the part where command line
arguments are parsed, so this fixes it to create a valid dtb.
diff --git a/scripts/dtbtool_exynos/dtbtool.c b/scripts/dtbtool_exynos/dtbtool.c
index f72fe8662ee..cacd8c69a32 100644
--- a/scripts/dtbtool_exynos/dtbtool.c
+++ b/scripts/dtbtool_exynos/dtbtool.c
@@ -378,13 +378,14 @@ int main(int argc, char **argv)
dt_subtype_code = strtoul(val, 0, 16);
} else if (*arg != '-') {
/* skip over already allocated file names */
- for (; dtb_files[dt_count]; dt_count++)
- if (dt_count >= DTB_MAX)
- fail("reached dtb file limit (%d)", DTB_MAX);
-
- dtb_files[dt_count] = strdup(arg);
- if (!dtb_files[dt_count])
- fail("failed to allocate memory");
+ for (; dtb_files[dt_count]; dt_count++) {
+ if (dt_count >= DTB_MAX) {
+ fail("reached dtb file limit (%d)", DTB_MAX);
+ } else {
+ dtb_files[dt_count] = strdup(arg);
+ if (!dtb_files[dt_count]) fail("failed to allocate memory");
+ }
+ }
} else
usage();
}