Revision fc98eb43
b/hw/qdev.c | ||
---|---|---|
555 | 555 |
pos = 0; |
556 | 556 |
} else { |
557 | 557 |
if (sscanf(path, "%127[^/]%n", elem, &len) != 1) { |
558 |
error_report("path parse error (\"%s\")", path);
|
|
559 |
return NULL;
|
|
558 |
assert(!path[0]);
|
|
559 |
elem[0] = len = 0;
|
|
560 | 560 |
} |
561 | 561 |
bus = qbus_find_recursive(main_system_bus, elem, NULL); |
562 | 562 |
if (!bus) { |
... | ... | |
567 | 567 |
} |
568 | 568 |
|
569 | 569 |
for (;;) { |
570 |
assert(path[pos] == '/' || !path[pos]); |
|
571 |
while (path[pos] == '/') { |
|
572 |
pos++; |
|
573 |
} |
|
570 | 574 |
if (path[pos] == '\0') { |
571 |
/* we are done */ |
|
572 | 575 |
return bus; |
573 | 576 |
} |
574 | 577 |
|
575 | 578 |
/* find device */ |
576 |
if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) {
|
|
577 |
error_report("path parse error (\"%s\" pos %d)", path, pos);
|
|
578 |
return NULL;
|
|
579 |
if (sscanf(path+pos, "%127[^/]%n", elem, &len) != 1) { |
|
580 |
assert(0);
|
|
581 |
elem[0] = len = 0;
|
|
579 | 582 |
} |
580 | 583 |
pos += len; |
581 | 584 |
dev = qbus_find_dev(bus, elem); |
... | ... | |
584 | 587 |
qbus_list_dev(bus); |
585 | 588 |
return NULL; |
586 | 589 |
} |
590 |
|
|
591 |
assert(path[pos] == '/' || !path[pos]); |
|
592 |
while (path[pos] == '/') { |
|
593 |
pos++; |
|
594 |
} |
|
587 | 595 |
if (path[pos] == '\0') { |
588 | 596 |
/* last specified element is a device. If it has exactly |
589 | 597 |
* one child bus accept it nevertheless */ |
... | ... | |
601 | 609 |
} |
602 | 610 |
|
603 | 611 |
/* find bus */ |
604 |
if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) {
|
|
605 |
error_report("path parse error (\"%s\" pos %d)", path, pos);
|
|
606 |
return NULL;
|
|
612 |
if (sscanf(path+pos, "%127[^/]%n", elem, &len) != 1) { |
|
613 |
assert(0);
|
|
614 |
elem[0] = len = 0;
|
|
607 | 615 |
} |
608 | 616 |
pos += len; |
609 | 617 |
bus = qbus_find_bus(dev, elem); |
Also available in: Unified diff