In the last section if the function determines that the config is invalid when QEMU doesn't support the memory device the JSON config object would be returned even if it doesn't make sense. Assign the object to be returned only on success.