@@ -194,7 +194,7 @@ static inline bool use_kmalloc(size_t size)
194
194
* @what: What is being allocated (for error logging)
195
195
* @ptr: A pointer to hold the allocated memory
196
196
*
197
- * Return: UDS_SUCCESS or an error code
197
+ * Return: VDO_SUCCESS or an error code
198
198
*/
199
199
int vdo_allocate_memory (size_t size , size_t align , const char * what , void * ptr )
200
200
{
@@ -216,12 +216,12 @@ int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
216
216
unsigned long start_time ;
217
217
void * p = NULL ;
218
218
219
- if (ptr == NULL )
220
- return UDS_INVALID_ARGUMENT ;
219
+ if (unlikely ( ptr == NULL ) )
220
+ return - EINVAL ;
221
221
222
222
if (size == 0 ) {
223
223
* ((void * * ) ptr ) = NULL ;
224
- return UDS_SUCCESS ;
224
+ return VDO_SUCCESS ;
225
225
}
226
226
227
227
if (allocations_restricted )
@@ -245,7 +245,7 @@ int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
245
245
} else {
246
246
struct vmalloc_block_info * block ;
247
247
248
- if (vdo_allocate (1 , struct vmalloc_block_info , __func__ , & block ) == UDS_SUCCESS ) {
248
+ if (vdo_allocate (1 , struct vmalloc_block_info , __func__ , & block ) == VDO_SUCCESS ) {
249
249
/*
250
250
* It is possible for __vmalloc to fail to allocate memory because there
251
251
* are no pages available. A short sleep may allow the page reclaimer
@@ -290,7 +290,7 @@ int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
290
290
}
291
291
292
292
* ((void * * ) ptr ) = p ;
293
- return UDS_SUCCESS ;
293
+ return VDO_SUCCESS ;
294
294
}
295
295
296
296
/*
@@ -335,7 +335,7 @@ void vdo_free(void *ptr)
335
335
* @what: What is being allocated (for error logging)
336
336
* @new_ptr: A pointer to hold the reallocated pointer
337
337
*
338
- * Return: UDS_SUCCESS or an error code
338
+ * Return: VDO_SUCCESS or an error code
339
339
*/
340
340
int vdo_reallocate_memory (void * ptr , size_t old_size , size_t size , const char * what ,
341
341
void * new_ptr )
@@ -345,11 +345,11 @@ int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *w
345
345
if (size == 0 ) {
346
346
vdo_free (ptr );
347
347
* (void * * ) new_ptr = NULL ;
348
- return UDS_SUCCESS ;
348
+ return VDO_SUCCESS ;
349
349
}
350
350
351
351
result = vdo_allocate (size , char , what , new_ptr );
352
- if (result != UDS_SUCCESS )
352
+ if (result != VDO_SUCCESS )
353
353
return result ;
354
354
355
355
if (ptr != NULL ) {
@@ -360,7 +360,7 @@ int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *w
360
360
vdo_free (ptr );
361
361
}
362
362
363
- return UDS_SUCCESS ;
363
+ return VDO_SUCCESS ;
364
364
}
365
365
366
366
int vdo_duplicate_string (const char * string , const char * what , char * * new_string )
@@ -369,12 +369,12 @@ int vdo_duplicate_string(const char *string, const char *what, char **new_string
369
369
u8 * dup ;
370
370
371
371
result = vdo_allocate (strlen (string ) + 1 , u8 , what , & dup );
372
- if (result != UDS_SUCCESS )
372
+ if (result != VDO_SUCCESS )
373
373
return result ;
374
374
375
375
memcpy (dup , string , strlen (string ) + 1 );
376
376
* new_string = dup ;
377
- return UDS_SUCCESS ;
377
+ return VDO_SUCCESS ;
378
378
}
379
379
380
380
void vdo_memory_init (void )
0 commit comments