Merge tag 'v2.8.0-rc4' into develop
[sdk/emulator/qemu.git] / block / raw-win32.c
index 800fabd..46dae71 100644 (file)
@@ -327,13 +327,13 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
                     Error **errp)
 {
     BDRVRawState *s = bs->opaque;
-    int access_flags;
-    DWORD overlapped;
     QemuOpts *opts;
     Error *local_err = NULL;
     const char *filename;
     bool use_aio;
     int ret;
+    DWORD overlapped;
+    int access_flags;
 
     s->type = FTYPE_FILE;
 
@@ -370,7 +370,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
     s->hfile = CreateFile(filename, access_flags,
                           FILE_SHARE_READ, NULL,
                           OPEN_EXISTING, overlapped, NULL);
-    if (s->hfile == INVALID_HANDLE_VALUE) {
+       if (s->hfile == INVALID_HANDLE_VALUE) {
         int err = GetLastError();
 
         error_setg_win32(errp, err, "Could not open '%s'", filename);
@@ -677,8 +677,8 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
 {
     BDRVRawState *s = bs->opaque;
     int access_flags, create_flags;
-    int ret = 0;
     DWORD overlapped;
+    int ret = 0;
     char device_name[64];
 
     Error *local_err = NULL;
@@ -731,7 +731,7 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
     s->hfile = CreateFile(filename, access_flags,
                           FILE_SHARE_READ, NULL,
                           create_flags, overlapped, NULL);
-    if (s->hfile == INVALID_HANDLE_VALUE) {
+       if (s->hfile == INVALID_HANDLE_VALUE) {
         int err = GetLastError();
 
         if (err == ERROR_ACCESS_DENIED) {
@@ -742,6 +742,7 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
         error_setg_errno(errp, -ret, "Could not open device");
         goto done;
     }
+    return 0;
 
 done:
     qemu_opts_del(opts);