Revision 0204276b hw/qdev.c
b/hw/qdev.c | ||
---|---|---|
200 | 200 |
|
201 | 201 |
driver = qemu_opt_get(opts, "driver"); |
202 | 202 |
if (!driver) { |
203 |
error_report("-device: no driver specified");
|
|
203 |
qerror_report(QERR_MISSING_PARAMETER, "driver");
|
|
204 | 204 |
return NULL; |
205 | 205 |
} |
206 | 206 |
|
207 | 207 |
/* find driver */ |
208 | 208 |
info = qdev_find_info(NULL, driver); |
209 | 209 |
if (!info || info->no_user) { |
210 |
error_report("Device \"%s\" not found. Try -device '?' for a list.",
|
|
211 |
driver);
|
|
210 |
qerror_report(QERR_INVALID_PARAMETER, "driver");
|
|
211 |
error_printf_unless_qmp("Try with argument '?' for a list.\n");
|
|
212 | 212 |
return NULL; |
213 | 213 |
} |
214 | 214 |
|
... | ... | |
220 | 220 |
return NULL; |
221 | 221 |
} |
222 | 222 |
if (bus->info != info->bus_info) { |
223 |
error_report("Device '%s' can't go on a %s bus",
|
|
224 |
driver, bus->info->name); |
|
223 |
qerror_report(QERR_BAD_BUS_FOR_DEVICE,
|
|
224 |
driver, bus->info->name);
|
|
225 | 225 |
return NULL; |
226 | 226 |
} |
227 | 227 |
} else { |
228 | 228 |
bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info); |
229 | 229 |
if (!bus) { |
230 |
error_report("Did not find %s bus for %s",
|
|
231 |
info->bus_info->name, info->name);
|
|
230 |
qerror_report(QERR_NO_BUS_FOR_DEVICE,
|
|
231 |
info->name, info->bus_info->name);
|
|
232 | 232 |
return NULL; |
233 | 233 |
} |
234 | 234 |
} |
235 | 235 |
if (qdev_hotplug && !bus->allow_hotplug) { |
236 |
error_report("Bus %s does not support hotplugging", |
|
237 |
bus->name); |
|
236 |
qerror_report(QERR_BUS_NO_HOTPLUG, bus->name); |
|
238 | 237 |
return NULL; |
239 | 238 |
} |
240 | 239 |
|
... | ... | |
249 | 248 |
return NULL; |
250 | 249 |
} |
251 | 250 |
if (qdev_init(qdev) < 0) { |
252 |
error_report("Error initializing device %s", driver);
|
|
251 |
qerror_report(QERR_DEVICE_INIT_FAILED, driver);
|
|
253 | 252 |
return NULL; |
254 | 253 |
} |
255 | 254 |
qdev->opts = opts; |
Also available in: Unified diff