aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/dtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dtc/dtc.c')
-rw-r--r--scripts/dtc/dtc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
index a4edf4c7aebf..f5eed9d72c02 100644
--- a/scripts/dtc/dtc.c
+++ b/scripts/dtc/dtc.c
@@ -138,7 +138,7 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
138static const char *guess_input_format(const char *fname, const char *fallback) 138static const char *guess_input_format(const char *fname, const char *fallback)
139{ 139{
140 struct stat statbuf; 140 struct stat statbuf;
141 uint32_t magic; 141 fdt32_t magic;
142 FILE *f; 142 FILE *f;
143 143
144 if (stat(fname, &statbuf) != 0) 144 if (stat(fname, &statbuf) != 0)
@@ -159,8 +159,7 @@ static const char *guess_input_format(const char *fname, const char *fallback)
159 } 159 }
160 fclose(f); 160 fclose(f);
161 161
162 magic = fdt32_to_cpu(magic); 162 if (fdt32_to_cpu(magic) == FDT_MAGIC)
163 if (magic == FDT_MAGIC)
164 return "dtb"; 163 return "dtb";
165 164
166 return guess_type_by_name(fname, fallback); 165 return guess_type_by_name(fname, fallback);
@@ -216,7 +215,7 @@ int main(int argc, char *argv[])
216 alignsize = strtol(optarg, NULL, 0); 215 alignsize = strtol(optarg, NULL, 0);
217 if (!is_power_of_2(alignsize)) 216 if (!is_power_of_2(alignsize))
218 die("Invalid argument \"%d\" to -a option\n", 217 die("Invalid argument \"%d\" to -a option\n",
219 optarg); 218 alignsize);
220 break; 219 break;
221 case 'f': 220 case 'f':
222 force = true; 221 force = true;
@@ -309,6 +308,8 @@ int main(int argc, char *argv[])
309 else 308 else
310 die("Unknown input format \"%s\"\n", inform); 309 die("Unknown input format \"%s\"\n", inform);
311 310
311 dti->outname = outname;
312
312 if (depfile) { 313 if (depfile) {
313 fputc('\n', depfile); 314 fputc('\n', depfile);
314 fclose(depfile); 315 fclose(depfile);