core/device: Load stored attributes before initializing GATT client

During gatt_client_init service are requested to accept the connection
which may leads the driver to check existence of attributes.
diff --git a/src/device.c b/src/device.c
index fd928fc..73bcc8f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4823,12 +4823,12 @@
 	dst = device_get_address(dev);
 	ba2str(dst, dstaddr);
 
-	gatt_client_init(dev);
-	gatt_server_init(dev, btd_gatt_database_get_db(database));
-
 	if (gatt_db_isempty(dev->db))
 		load_gatt_db(dev, srcaddr, dstaddr);
 
+	gatt_client_init(dev);
+	gatt_server_init(dev, btd_gatt_database_get_db(database));
+
 	/*
 	 * Remove the device from the connect_list and give the passive
 	 * scanning another chance to be restarted in case there are