Stop adding an extra null terminator to strings, OF_getprop already returns
a null terminated string.
This commit is contained in:
parent
d555ff6357
commit
f0f0917197
@ -401,10 +401,9 @@ mv_twsi_attach(device_t dev)
|
|||||||
for (child = OF_child(ofw_bus_get_node(dev)); child != 0;
|
for (child = OF_child(ofw_bus_get_node(dev)); child != 0;
|
||||||
child = OF_peer(child)) {
|
child = OF_peer(child)) {
|
||||||
len = OF_getproplen(child, "model");
|
len = OF_getproplen(child, "model");
|
||||||
if (len <= 0 || len > sizeof(dname) - 1)
|
if (len <= 0 || len > sizeof(dname))
|
||||||
continue;
|
continue;
|
||||||
error = OF_getprop(child, "model", &dname, len);
|
error = OF_getprop(child, "model", &dname, len);
|
||||||
dname[len + 1] = '\0';
|
|
||||||
if (error == -1)
|
if (error == -1)
|
||||||
continue;
|
continue;
|
||||||
len = strlen(dname);
|
len = strlen(dname);
|
||||||
@ -428,10 +427,9 @@ mv_twsi_attach(device_t dev)
|
|||||||
|
|
||||||
/* Get device driver name. */
|
/* Get device driver name. */
|
||||||
len = OF_getproplen(child, "model");
|
len = OF_getproplen(child, "model");
|
||||||
if (len <= 0 || len > sizeof(dname) - 1)
|
if (len <= 0 || len > sizeof(dname))
|
||||||
continue;
|
continue;
|
||||||
OF_getprop(child, "model", &dname, len);
|
OF_getprop(child, "model", &dname, len);
|
||||||
dname[len + 1] = '\0';
|
|
||||||
|
|
||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
device_printf(dev, "adding a device %s at %d.\n",
|
device_printf(dev, "adding a device %s at %d.\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user