summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blockdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c
index d74cd1d802..f636bc6916 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -493,9 +493,11 @@ void do_commit(Monitor *mon, const QDict *qdict)
bdrv_commit_all();
} else {
bs = bdrv_find(device);
- if (bs) {
- bdrv_commit(bs);
+ if (!bs) {
+ qerror_report(QERR_DEVICE_NOT_FOUND, device);
+ return;
}
+ bdrv_commit(bs);
}
}