Revision ac8dae67

b/hw/qdev.c
216 216
    path = qemu_opt_get(opts, "bus");
217 217
    if (path != NULL) {
218 218
        bus = qbus_find(path);
219
        if (bus && bus->info != info->bus_info) {
219
        if (!bus) {
220
            return NULL;
221
        }
222
        if (bus->info != info->bus_info) {
220 223
            error_report("Device '%s' can't go on a %s bus",
221 224
                         driver, bus->info->name);
222 225
            return NULL;
223 226
        }
224 227
    } else {
225 228
        bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info);
226
    }
227
    if (!bus) {
228
        error_report("Did not find %s bus for %s",
229
                     path ? path : info->bus_info->name, info->name);
230
        return NULL;
229
        if (!bus) {
230
            error_report("Did not find %s bus for %s",
231
                         info->bus_info->name, info->name);
232
            return NULL;
233
        }
231 234
    }
232 235
    if (qdev_hotplug && !bus->allow_hotplug) {
233 236
        error_report("Bus %s does not support hotplugging",
......
560 563
        }
561 564
        bus = qbus_find_recursive(main_system_bus, elem, NULL);
562 565
        if (!bus) {
563
            error_report("bus \"%s\" not found", elem);
566
            qerror_report(QERR_BUS_NOT_FOUND, elem);
564 567
            return NULL;
565 568
        }
566 569
        pos = len;
......
583 586
        pos += len;
584 587
        dev = qbus_find_dev(bus, elem);
585 588
        if (!dev) {
586
            error_report("device \"%s\" not found", elem);
589
            qerror_report(QERR_DEVICE_NOT_FOUND, elem);
587 590
            qbus_list_dev(bus);
588 591
            return NULL;
589 592
        }
......
597 600
             * one child bus accept it nevertheless */
598 601
            switch (dev->num_child_bus) {
599 602
            case 0:
600
                error_report("device has no child bus (%s)", path);
603
                qerror_report(QERR_DEVICE_NO_BUS, elem);
601 604
                return NULL;
602 605
            case 1:
603 606
                return QLIST_FIRST(&dev->child_bus);
604 607
            default:
605
                error_report("device has multiple child busses (%s)", path);
608
                qerror_report(QERR_DEVICE_MULTIPLE_BUSSES, elem);
606 609
                qbus_list_bus(dev);
607 610
                return NULL;
608 611
            }
......
616 619
        pos += len;
617 620
        bus = qbus_find_bus(dev, elem);
618 621
        if (!bus) {
619
            error_report("child bus \"%s\" not found", elem);
622
            qerror_report(QERR_BUS_NOT_FOUND, elem);
620 623
            qbus_list_bus(dev);
621 624
            return NULL;
622 625
        }

Also available in: Unified diff