dev/ofw: Fix ofw_fdt_getprop() return values to match documentation
Fix the behavior of ofw_fdt_getprop() and ofw_fdt_getprop() functions to match the documentation as the non-fdt code. Submitted by: Luis Pires <lffpires@ruabrasil.org> Reviewed by: manu, jhibbits Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D15680
This commit is contained in:
parent
8d7181d1e0
commit
4a4b4c98f5
@ -279,8 +279,6 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf,
|
||||
/* Emulate the 'name' property */
|
||||
name = fdt_get_name(fdtp, offset, &len);
|
||||
strncpy(buf, name, buflen);
|
||||
if (len + 1 > buflen)
|
||||
len = buflen;
|
||||
return (len + 1);
|
||||
}
|
||||
|
||||
@ -299,9 +297,8 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf,
|
||||
if (prop == NULL)
|
||||
return (-1);
|
||||
|
||||
if (len > buflen)
|
||||
len = buflen;
|
||||
bcopy(prop, buf, len);
|
||||
bcopy(prop, buf, min(len, buflen));
|
||||
|
||||
return (len);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user