# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 38bee85ddeb83378eb9ba9b692cc39499d6a05d4
# Parent f6d6d17eaeb5f04efea7f9d8f753a91ffff0479d
# Parent 1fb1877ed6d1b2ae5b130e4d3e29fc06ef58db3c
merge
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/Makefile
--- a/tools/libxc/Makefile Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/Makefile Fri Aug 12 13:29:57 2005
@@ -7,7 +7,7 @@
MAJOR = 3.0
MINOR = 0
-CC = gcc
+CC = sparse
XEN_ROOT = ../..
include $(XEN_ROOT)/tools/Rules.mk
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/xc_core.c Fri Aug 12 13:29:57 2005
@@ -43,7 +43,7 @@
goto error_out;
}
- if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == 0) {
+ if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == NULL) {
PERROR("Could not allocate dump_mem");
goto error_out;
}
@@ -108,9 +108,8 @@
free(dump_mem_start);
return 0;
error_out:
- if (dump_fd)
+ if (dump_fd != -1)
close(dump_fd);
- if (dump_mem_start)
- free(dump_mem_start);
+ free(dump_mem_start);
return -1;
}
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/xc_linux_build.c Fri Aug 12 13:29:57 2005
@@ -318,8 +318,7 @@
return 0;
error_out:
- if ( page_array != NULL )
- free(page_array);
+ free(page_array);
return -1;
}
#else /* x86 */
@@ -616,10 +615,8 @@
return 0;
error_out:
- if ( mmu != NULL )
- free(mmu);
- if ( page_array != NULL )
- free(page_array);
+ free(mmu);
+ free(page_array);
return -1;
}
#endif
@@ -719,8 +716,7 @@
close(initrd_fd);
if ( initrd_gfd )
gzclose(initrd_gfd);
- if ( image != NULL )
- free(image);
+ free(image);
#ifdef __ia64__
/* based on new_thread in xen/arch/ia64/domain.c */
@@ -806,8 +802,7 @@
gzclose(initrd_gfd);
else if ( initrd_fd >= 0 )
close(initrd_fd);
- if ( image != NULL )
- free(image);
+ free(image);
return -1;
}
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/xc_linux_restore.c Fri Aug 12 13:29:57 2005
@@ -32,7 +32,7 @@
#define PPRINTF(_f, _a...)
#endif
-ssize_t
+static ssize_t
read_exact(int fd, void *buf, size_t count)
{
int r = 0, s;
@@ -607,12 +607,9 @@
out:
if ( (rc != 0) && (dom != 0) )
xc_domain_destroy(xc_handle, dom);
- if ( mmu != NULL )
- free(mmu);
- if ( pfn_to_mfn_table != NULL )
- free(pfn_to_mfn_table);
- if ( pfn_type != NULL )
- free(pfn_type);
+ free(mmu);
+ free(pfn_to_mfn_table);
+ free(pfn_type);
DPRINTF("Restore exit with rc=%d\n", rc);
return rc;
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/xc_linux_save.c Fri Aug 12 13:29:57 2005
@@ -136,7 +136,7 @@
return (new->tv_sec * 1000000) + new->tv_usec;
}
-static long long llgettimeofday()
+static long long llgettimeofday( void )
{
struct timeval now;
gettimeofday(&now, NULL);
@@ -312,9 +312,9 @@
}
-int suspend_and_state(int xc_handle, int io_fd, int dom,
- xc_dominfo_t *info,
- vcpu_guest_context_t *ctxt)
+static int suspend_and_state(int xc_handle, int io_fd, int dom,
+ xc_dominfo_t *info,
+ vcpu_guest_context_t *ctxt)
{
int i=0;
char ans[30];
@@ -1051,20 +1051,11 @@
if(live_mfn_to_pfn_table)
munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024);
- if (pfn_type != NULL)
- free(pfn_type);
-
- if (pfn_batch != NULL)
- free(pfn_batch);
-
- if (to_send != NULL)
- free(to_send);
-
- if (to_fix != NULL)
- free(to_fix);
-
- if (to_skip != NULL)
- free(to_skip);
+ free(pfn_type);
+ free(pfn_batch);
+ free(to_send);
+ free(to_fix);
+ free(to_skip);
DPRINTF("Save exit rc=%d\n",rc);
return !!rc;
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/xc_load_elf.c
--- a/tools/libxc/xc_load_elf.c Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/xc_load_elf.c Fri Aug 12 13:29:57 2005
@@ -309,8 +309,7 @@
dsi->v_end = round_pgup(maxva);
out:
- if ( p != NULL )
- free(p);
+ free(p);
return 0;
}
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/xc_ptrace.c Fri Aug 12 13:29:57 2005
@@ -221,7 +221,7 @@
return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK));
error_out:
- return 0;
+ return NULL;
}
int
diff -r f6d6d17eaeb5 -r 38bee85ddeb8 tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c Fri Aug 12 13:06:23 2005
+++ b/tools/libxc/xc_vmx_build.c Fri Aug 12 13:29:57 2005
@@ -616,17 +616,15 @@
return 0;
error_out:
- if ( mmu != NULL )
- free(mmu);
- if ( page_array != NULL )
- free(page_array);
+ free(mmu);
+ free(page_array);
return -1;
}
#define VMX_FEATURE_FLAG 0x20
-int vmx_identify(void)
+static int vmx_identify(void)
{
int eax, ecx;
@@ -745,8 +743,7 @@
close(initrd_fd);
if ( initrd_gfd )
gzclose(initrd_gfd);
- if ( image != NULL )
- free(image);
+ free(image);
ctxt->flags = VGCF_VMX_GUEST;
/* FPU is set up to default initial state. */
@@ -801,8 +798,7 @@
gzclose(initrd_gfd);
else if ( initrd_fd >= 0 )
close(initrd_fd);
- if ( image != NULL )
- free(image);
+ free(image);
return -1;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|