Resolve gcc 4.9.0
20140507 warnings about uninitialized 'ptr' when
using -Wmaybe-uninitialized. The first two cases appears appear
to be legitimate but not the second two. In general this is a
good practice so they are all initialized.
Signed-off-by: Marcel Huber <marcelhuberfoo@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2345
static inline void *
umem_alloc(size_t size, int flags)
{
- void *ptr;
+ void *ptr = NULL;
do {
ptr = malloc(size);
static inline void *
umem_alloc_aligned(size_t size, size_t align, int flags)
{
- void *ptr;
- int rc;
+ void *ptr = NULL;
+ int rc = EINVAL;
do {
rc = posix_memalign(&ptr, align, size);
static inline void *
umem_zalloc(size_t size, int flags)
{
- void *ptr;
+ void *ptr = NULL;
ptr = umem_alloc(size, flags);
if (ptr)
static inline void *
umem_cache_alloc(umem_cache_t *cp, int flags)
{
- void *ptr;
+ void *ptr = NULL;
if (cp->cache_align != 0)
ptr = umem_alloc_aligned(