]> Git Repo - qemu.git/commitdiff
usb-mtp: Unconditionally check for the readonly bit
authorBandan Das <[email protected]>
Thu, 3 May 2018 19:20:28 +0000 (15:20 -0400)
committerGerd Hoffmann <[email protected]>
Mon, 7 May 2018 09:10:25 +0000 (11:10 +0200)
Currently, it's only being checked if desc is NULL and
so write support breaks upon specifying desc

Signed-off-by: Bandan Das <[email protected]>
Message-id: 20180503192028[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
hw/usb/dev-mtp.c

index 24cff640c01c27bdb088afebe9fcd3ca37a06c19..3d59fe494431d85f01852c4d8f15a691d2a4263e 100644 (file)
@@ -1948,16 +1948,17 @@ static void usb_mtp_realize(USBDevice *dev, Error **errp)
             return;
         }
         s->desc = strrchr(s->root, '/');
-        /* Mark store as RW */
-        if (!s->readonly) {
-            s->flags |= (1 << MTP_FLAG_WRITABLE);
-        }
         if (s->desc && s->desc[0]) {
             s->desc = g_strdup(s->desc + 1);
         } else {
             s->desc = g_strdup("none");
         }
     }
+    /* Mark store as RW */
+    if (!s->readonly) {
+        s->flags |= (1 << MTP_FLAG_WRITABLE);
+    }
+
 }
 
 static const VMStateDescription vmstate_usb_mtp = {
This page took 0.029086 seconds and 4 git commands to generate.