diff options
author | Rob Herring <robh@kernel.org> | 2015-04-29 23:00:05 +0200 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2015-04-30 00:17:27 +0200 |
commit | 4760597116e34bd58f670d008ae7323653268fb4 (patch) | |
tree | 2b27799a1dfc5171c7d502cb2ffe094d93ecf7f8 /scripts/dtc/util.c | |
parent | libfdt: add fdt type definitions (diff) | |
download | linux-4760597116e34bd58f670d008ae7323653268fb4.tar.xz linux-4760597116e34bd58f670d008ae7323653268fb4.zip |
scripts/dtc: Update to upstream version 9d3649bd3be245c9
Sync dtc with upstream as of commit 9d3649bd3be2 (Add testcases for
fdt_path_offset_namelen()).
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: devicetree@vger.kernel.org
Diffstat (limited to 'scripts/dtc/util.c')
-rw-r--r-- | scripts/dtc/util.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c index 3055c16e980d..9d65226df9e4 100644 --- a/scripts/dtc/util.c +++ b/scripts/dtc/util.c @@ -39,11 +39,11 @@ char *xstrdup(const char *s) { int len = strlen(s) + 1; - char *dup = xmalloc(len); + char *d = xmalloc(len); - memcpy(dup, s, len); + memcpy(d, s, len); - return dup; + return d; } char *join_path(const char *path, const char *name) @@ -70,7 +70,7 @@ char *join_path(const char *path, const char *name) return str; } -int util_is_printable_string(const void *data, int len) +bool util_is_printable_string(const void *data, int len) { const char *s = data; const char *ss, *se; @@ -87,7 +87,7 @@ int util_is_printable_string(const void *data, int len) while (s < se) { ss = s; - while (s < se && *s && isprint(*s)) + while (s < se && *s && isprint((unsigned char)*s)) s++; /* not zero, or not done yet */ @@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len) if (offset == bufsize) { bufsize *= 2; buf = xrealloc(buf, bufsize); - if (!buf) { - ret = ENOMEM; - break; - } } ret = read(fd, &buf[offset], bufsize - offset); @@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data, int len) const uint32_t *cell = (const uint32_t *)data; printf(" = <"); - for (i = 0; i < len; i += 4) + for (i = 0, len /= 4; i < len; i++) printf("0x%08x%s", fdt32_to_cpu(cell[i]), - i < (len - 4) ? " " : ""); + i < (len - 1) ? " " : ""); printf(">"); } else { printf(" = ["); |