On 12/11/24 11:21, Daniel P. Smith wrote:
On 12/2/24 07:02, Jan Beulich wrote:
On 23.11.2024 19:20, Daniel P. Smith wrote:
--- a/xen/arch/x86/domain_builder/fdt.h
+++ b/xen/arch/x86/domain_builder/fdt.h
@@ -27,6 +27,24 @@ static inline int __init fdt_cell_as_u64(const
fdt32_t *cell, uint64_t *val)
return 0;
}
+static inline int __init fdt_prop_as_u32(
+ const struct fdt_property *prop, uint32_t *val)
+{
+ if ( !prop || fdt32_to_cpu(prop->len) < sizeof(u32) )
+ return -EINVAL;
+
+ return fdt_cell_as_u32((fdt32_t *)prop->data, val);
+}
+
+static inline bool __init match_fdt_property(
+ const void *fdt, const struct fdt_property *prop, const char *s)
+{
+ int slen, len = strlen(s);
Plain int isn't quite appropriate for strlen()'s return. It doesn't
strictly
need to be size_t, but it should be at least unsigned int.
Ack.
I wanted to reply back on this one before posting the next version. By
implementing Jason's recommendation to unroll this function, the
strlen() call goes away and slen becomes name_len. But name_len remains
plain int to align with the fdt_get_string() parameter type.
v/r,
dps