summaryrefslogtreecommitdiffstats
path: root/blockdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/blockdev.c b/blockdev.c
index b376884..3b8c606 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -503,20 +503,18 @@ void do_commit(Monitor *mon, const QDict *qdict)
static int eject_device(Monitor *mon, BlockDriverState *bs, int force)
{
- if (bdrv_is_inserted(bs)) {
- if (!force) {
- if (!bdrv_is_removable(bs)) {
- qerror_report(QERR_DEVICE_NOT_REMOVABLE,
- bdrv_get_device_name(bs));
- return -1;
- }
- if (bdrv_is_locked(bs)) {
- qerror_report(QERR_DEVICE_LOCKED, bdrv_get_device_name(bs));
- return -1;
- }
+ if (!force) {
+ if (!bdrv_is_removable(bs)) {
+ qerror_report(QERR_DEVICE_NOT_REMOVABLE,
+ bdrv_get_device_name(bs));
+ return -1;
+ }
+ if (bdrv_is_locked(bs)) {
+ qerror_report(QERR_DEVICE_LOCKED, bdrv_get_device_name(bs));
+ return -1;
}
- bdrv_close(bs);
}
+ bdrv_close(bs);
return 0;
}
OpenPOWER on IntegriCloud