diff mbox series

[v2,3/4] migration: Fix cache_init()'s "Failed to allocate" error messages

Message ID 20210202141734.2488076-4-armbru@redhat.com
State New
Headers show
Series migration: Fixes and cleanups aroung migrate-set-parameters | expand

Commit Message

Markus Armbruster Feb. 2, 2021, 2:17 p.m. UTC
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 <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/page_cache.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Eric Blake Feb. 2, 2021, 2:23 p.m. UTC | #1
On 2/2/21 8:17 AM, Markus Armbruster wrote:
> cache_init() attempts to handle allocation failure..  The two error

The double . looks odd.

> 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 <armbru@redhat.com>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  migration/page_cache.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
Markus Armbruster Feb. 2, 2021, 3:21 p.m. UTC | #2
Eric Blake <eblake@redhat.com> writes:

> On 2/2/21 8:17 AM, Markus Armbruster wrote:
>> cache_init() attempts to handle allocation failure..  The two error
>
> The double . looks odd.

Typo.  Perhaps the maintainer can take care of it.

>> 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 <armbru@redhat.com>
>> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> ---
>>  migration/page_cache.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
Dr. David Alan Gilbert Feb. 2, 2021, 3:37 p.m. UTC | #3
* Markus Armbruster (armbru@redhat.com) wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
> > On 2/2/21 8:17 AM, Markus Armbruster wrote:
> >> cache_init() attempts to handle allocation failure..  The two error
> >
> > The double . looks odd.
> 
> Typo.  Perhaps the maintainer can take care of it.

Yeh I can try and remember to take it out on the merge.

> >> 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 <armbru@redhat.com>
> >> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> >> ---
> >>  migration/page_cache.c | 6 ++----
> >>  1 file changed, 2 insertions(+), 4 deletions(-)
> >>
diff mbox series

Patch

diff --git a/migration/page_cache.c b/migration/page_cache.c
index b384f265fb..6d4f7a9bbc 100644
--- a/migration/page_cache.c
+++ b/migration/page_cache.c
@@ -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;
     }