diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 969a6632b8866d57cb3630488bc817d7e4f7c027..5d0290d07f022d3e8f30a61bbf03a4fa60db344d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1404,6 +1404,22 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
     VIR_FREE(def);
 }
 
+const char *virDomainInputDefGetPath(virDomainInputDefPtr input)
+{
+    switch ((virDomainInputType) input->type) {
+    case VIR_DOMAIN_INPUT_TYPE_MOUSE:
+    case VIR_DOMAIN_INPUT_TYPE_TABLET:
+    case VIR_DOMAIN_INPUT_TYPE_KBD:
+    case VIR_DOMAIN_INPUT_TYPE_LAST:
+        return NULL;
+        break;
+
+    case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
+        return input->source.evdev;
+    }
+    return NULL;
+}
+
 void virDomainInputDefFree(virDomainInputDefPtr def)
 {
     if (!def)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cb8701dd21e087f92772509b8315106e31d2a380..e8ab9abdfcd98b2a6546977dbefa6b7d981c6ff0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2706,6 +2706,7 @@ int virDomainObjWaitUntil(virDomainObjPtr vm,
 void virDomainPanicDefFree(virDomainPanicDefPtr panic);
 void virDomainResourceDefFree(virDomainResourceDefPtr resource);
 void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
+const char *virDomainInputDefGetPath(virDomainInputDefPtr input);
 void virDomainInputDefFree(virDomainInputDefPtr def);
 virDomainDiskDefPtr virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt);
 void virDomainDiskDefFree(virDomainDiskDefPtr def);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7f4b7d69a8a716585e2b510ff5b9b05d37e7fa76..b4d3b9a94130a59100c6cbf4c0410623a8f8fad0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -395,6 +395,7 @@ virDomainHypervTypeToString;
 virDomainInputBusTypeToString;
 virDomainInputDefFind;
 virDomainInputDefFree;
+virDomainInputDefGetPath;
 virDomainIOMMUModelTypeFromString;
 virDomainIOMMUModelTypeToString;
 virDomainIOThreadIDAdd;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2bda4a726be96fa4019fba87e815655aea3a45a0..48c7cb70b443725105322d034f38b47c13ae4445 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9041,25 +9041,12 @@ qemuDomainSetupInput(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
                      virDomainInputDefPtr input,
                      const struct qemuDomainCreateDeviceData *data)
 {
-    int ret = -1;
-
-    switch ((virDomainInputType) input->type) {
-    case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
-        if (qemuDomainCreateDevice(input->source.evdev, data, false) < 0)
-            goto cleanup;
-        break;
+    const char *path = virDomainInputDefGetPath(input);
 
-    case VIR_DOMAIN_INPUT_TYPE_MOUSE:
-    case VIR_DOMAIN_INPUT_TYPE_TABLET:
-    case VIR_DOMAIN_INPUT_TYPE_KBD:
-    case VIR_DOMAIN_INPUT_TYPE_LAST:
-        /* nada */
-        break;
-    }
+    if (path && qemuDomainCreateDevice(path, data, false) < 0)
+        return -1;
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }