aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r--hw/ide/qdev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index c436b38bcb..fd06da7003 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -143,7 +143,10 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);
IDEState *s = bus->ifs + dev->unit;
- if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) {
+ if (dev->conf.discard_granularity == -1) {
+ dev->conf.discard_granularity = 512;
+ } else if (dev->conf.discard_granularity &&
+ dev->conf.discard_granularity != 512) {
error_report("discard_granularity must be 512 for ide");
return -1;
}