Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
 block.c       |    5 +++++
 block/qcow2.c |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block.c b/block.c
index e806ad8..e293882 100644
--- a/block.c
+++ b/block.c
@@ -1403,6 +1403,11 @@ int bdrv_change_backing_file(BlockDriverState *bs,
 {
     BlockDriver *drv = bs->drv;
 
+    /* Backing file format doesn't make sense without a backing file */
+    if (backing_fmt && !backing_file) {
+        return -EINVAL;
+    }
+
     if (drv->bdrv_change_backing_file != NULL) {
         return drv->bdrv_change_backing_file(bs, backing_file, backing_fmt);
     } else {
diff --git a/block/qcow2.c b/block/qcow2.c
index 70d3141..342d8ff 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -843,11 +843,6 @@ fail:
 static int qcow2_change_backing_file(BlockDriverState *bs,
     const char *backing_file, const char *backing_fmt)
 {
-    /* Backing file format doesn't make sense without a backing file */
-    if (backing_fmt && !backing_file) {
-        return -EINVAL;
-    }
-
     pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: "");
     pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: "");
 
-- 
1.7.9.3



Reply via email to