ide: Improve error messages
Use error_report(), because it points to the error location. Reword "tried to assign twice" messages to make it clear that we're complaining about the unit property. Report invalid unit property instead of failing silently. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
42e766a24b
commit
f597627ff5
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
#include <hw/hw.h>
|
#include <hw/hw.h>
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
|
#include "qemu-error.h"
|
||||||
#include <hw/ide/internal.h>
|
#include <hw/ide/internal.h>
|
||||||
|
|
||||||
/* --------------------------------- */
|
/* --------------------------------- */
|
||||||
|
@ -40,7 +40,7 @@ static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
||||||
IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus);
|
IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus);
|
||||||
|
|
||||||
if (!dev->conf.bs) {
|
if (!dev->conf.bs) {
|
||||||
fprintf(stderr, "%s: no drive specified\n", qdev->info->name);
|
error_report("No drive specified");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (dev->unit == -1) {
|
if (dev->unit == -1) {
|
||||||
|
@ -49,19 +49,20 @@ static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
||||||
switch (dev->unit) {
|
switch (dev->unit) {
|
||||||
case 0:
|
case 0:
|
||||||
if (bus->master) {
|
if (bus->master) {
|
||||||
fprintf(stderr, "ide: tried to assign master twice\n");
|
error_report("IDE unit %d is in use", dev->unit);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
bus->master = dev;
|
bus->master = dev;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (bus->slave) {
|
if (bus->slave) {
|
||||||
fprintf(stderr, "ide: tried to assign slave twice\n");
|
error_report("IDE unit %d is in use", dev->unit);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
bus->slave = dev;
|
bus->slave = dev;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
error_report("Invalid IDE unit %d", dev->unit);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
return info->init(dev);
|
return info->init(dev);
|
||||||
|
|
Loading…
Reference in a new issue