diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2016-10-06 20:45:14 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-10-06 20:45:14 +1100 |
commit | 7b7a6be9ba159125a8e11b7ccc86233d17109187 (patch) | |
tree | ad00aa2e6c7325a93281284cbf9700e2be278ba5 /tests | |
parent | aea8860d831ed05a147a1896c15e1312a9a66917 (diff) | |
download | dtc-7b7a6be9ba159125a8e11b7ccc86233d17109187.zip dtc-7b7a6be9ba159125a8e11b7ccc86233d17109187.tar.gz dtc-7b7a6be9ba159125a8e11b7ccc86233d17109187.tar.bz2 |
libfdt: Don't use 'index' as a local variable name
Using 'index' as a local variable name shadows the standard library index()
function. This causes warnings on at least some compiler versions. The
recently added overlay code has a number of instances of this.
This patch replaces 'index' with 'poffset', since 'index' is being used to
mean "offset within a property value" in these cases.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/overlay.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/overlay.c b/tests/overlay.c index e467b03..961ed60 100644 --- a/tests/overlay.c +++ b/tests/overlay.c @@ -34,9 +34,9 @@ /* 4k ought to be enough for anybody */ #define FDT_COPY_SIZE (4 * 1024) -static int fdt_getprop_u32_by_index(void *fdt, const char *path, - const char *name, int index, - unsigned long *out) +static int fdt_getprop_u32_by_poffset(void *fdt, const char *path, + const char *name, int poffset, + unsigned long *out) { const fdt32_t *val; int node_off; @@ -47,10 +47,10 @@ static int fdt_getprop_u32_by_index(void *fdt, const char *path, return node_off; val = fdt_getprop(fdt, node_off, name, &len); - if (!val || (len < (sizeof(uint32_t) * (index + 1)))) + if (!val || (len < (sizeof(uint32_t) * (poffset + 1)))) return -FDT_ERR_NOTFOUND; - *out = fdt32_to_cpu(*(val + index)); + *out = fdt32_to_cpu(*(val + poffset)); return 0; } @@ -141,14 +141,14 @@ static int fdt_overlay_local_phandle(void *fdt) local_phandle = fdt_get_phandle(fdt, off); CHECK(!local_phandle); - CHECK(fdt_getprop_u32_by_index(fdt, "/test-node", - "test-several-phandle", - 0, &val)); + CHECK(fdt_getprop_u32_by_poffset(fdt, "/test-node", + "test-several-phandle", + 0, &val)); CHECK(val != local_phandle); - CHECK(fdt_getprop_u32_by_index(fdt, "/test-node", - "test-several-phandle", - 1, &val)); + CHECK(fdt_getprop_u32_by_poffset(fdt, "/test-node", + "test-several-phandle", + 1, &val)); CHECK(val != local_phandle); return 0; @@ -172,12 +172,12 @@ static int fdt_overlay_local_phandles(void *fdt) test_phandle = fdt_get_phandle(fdt, off); CHECK(!test_phandle); - CHECK(fdt_getprop_u32_by_index(fdt, "/test-node", - "test-phandle", 0, &val)); + CHECK(fdt_getprop_u32_by_poffset(fdt, "/test-node", + "test-phandle", 0, &val)); CHECK(test_phandle != val); - CHECK(fdt_getprop_u32_by_index(fdt, "/test-node", - "test-phandle", 1, &val)); + CHECK(fdt_getprop_u32_by_poffset(fdt, "/test-node", + "test-phandle", 1, &val)); CHECK(local_phandle != val); return 0; |