]> Git Repo - qemu.git/commitdiff
migration: Fix cache_init()'s "Failed to allocate" error messages
authorMarkus Armbruster <[email protected]>
Tue, 2 Feb 2021 14:17:33 +0000 (15:17 +0100)
committerDr. David Alan Gilbert <[email protected]>
Mon, 8 Feb 2021 11:19:51 +0000 (11:19 +0000)
cache_init() attempts to handle allocation failure.  The two error
messages are garbage, as untested error messages commonly are:

    Parameter 'cache size' expects Failed to allocate cache
    Parameter 'cache size' expects Failed to allocate page cache

Fix them to just

    Failed to allocate cache
    Failed to allocate page cache

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20210202141734.2488076[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
migration/page_cache.c

index b384f265fba5bd29558979fda2a02e7fb8dedc50..6d4f7a9bbc1c0af9489506a6a0aa5e45ae3e43fe 100644 (file)
@@ -60,8 +60,7 @@ PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
     /* We prefer not to abort if there is no memory */
     cache = g_try_malloc(sizeof(*cache));
     if (!cache) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
-                   "Failed to allocate cache");
+        error_setg(errp, "Failed to allocate cache");
         return NULL;
     }
     cache->page_size = page_size;
@@ -74,8 +73,7 @@ PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
     cache->page_cache = g_try_malloc((cache->max_num_items) *
                                      sizeof(*cache->page_cache));
     if (!cache->page_cache) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
-                   "Failed to allocate page cache");
+        error_setg(errp, "Failed to allocate page cache");
         g_free(cache);
         return NULL;
     }
This page took 0.030955 seconds and 4 git commands to generate.