diff --git a/hw/qdev.c b/hw/qdev.c
index 7c4f039..c272c51 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -564,25 +564,17 @@ static DeviceState *qbus_find_dev(BusState *bus, char *elem)
 static BusState *qbus_find(const char *path)
 {
     DeviceState *dev;
-    BusState *bus;
+    BusState *bus = main_system_bus;
     char elem[128];
-    int pos, len;
+    int len, pos = 0;
 
-    /* find start element */
-    if (path[0] == '/') {
-        bus = main_system_bus;
-        pos = 0;
-    } else {
-        if (sscanf(path, "%127[^/]%n", elem, &len) != 1) {
-            assert(!path[0]);
-            elem[0] = len = 0;
-        }
-        bus = qbus_find_recursive(main_system_bus, elem, NULL);
+    /* search for bus name recursively if path is not absolute */
+    if (path[0] != '/') {
+        bus = qbus_find_recursive(bus, path, NULL);
         if (!bus) {
-            qerror_report(QERR_BUS_NOT_FOUND, elem);
-            return NULL;
+            qerror_report(QERR_BUS_NOT_FOUND, path);
         }
-        pos = len;
+        return bus;
     }
 
     for (;;) {
