|
| From: | Alexey Kardashevskiy |
| Subject: | Re: [PATCH qemu v2] spapr: Kill SLOF |
| Date: | Tue, 7 Jan 2020 00:39:42 +1100 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 |
On 06/01/2020 15:19, David Gibson wrote:
+ const struct fdt_property *prop; + const char *tmp; + + readstr(prevaddr, prev); + for (offset = fdt_first_property_offset(fdt, offset); + (offset >= 0); + (offset = fdt_next_property_offset(fdt, offset))) { + + prop = fdt_get_property_by_offset(fdt, offset, &namelen);fdt_getprop_by_offset() also returns the property's name without having to dick around with fdt_get_string() manually.
btw I looked quickly:
const void *fdt_getprop_by_offset(const void *fdt, int offset,
const char **namep, int *lenp)
{
const struct fdt_property *prop;
prop = fdt_get_property_by_offset_(fdt, offset, lenp);
if (!prop)
return NULL;
if (namep) {
const char *name;
int namelen;
name = fdt_get_string(fdt, fdt32_ld(&prop->nameoff),
&namelen);
if (!name) {
if (lenp)
*lenp = namelen;
return NULL;
}
*namep = name;
}
/* Handle realignment */
if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 &&
fdt32_ld(&prop->len) >= 8)
return prop->data + 4;
return prop->data;
}
and incorrectly assumed *lenp is the name length because of "*lenp = namelen".
Huh :)
--
Alexey
| [Prev in Thread] | Current Thread | [Next in Thread] |