From: Peter Dinda Date: Fri, 10 Jun 2011 20:45:55 +0000 (-0500) Subject: Fixed binding error in graphics console for new extension interface X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=1074795f0ba8f58ae03c8062e8b25d61e065648a Fixed binding error in graphics console for new extension interface --- diff --git a/linux_module/palacios-graphics-console.c b/linux_module/palacios-graphics-console.c index 3408fe7..e1d9216 100644 --- a/linux_module/palacios-graphics-console.c +++ b/linux_module/palacios-graphics-console.c @@ -78,7 +78,7 @@ static v3_graphics_console_t g_open(void * priv_data, gc = get_vm_ext_data(guest, "GRAPHICS_CONSOLE_INTERFACE"); if (gc == NULL) { - printk("ERROR: Could not locate gfx console data for extension GRAPHICS_CONSOLE_INTERFACE\n"); + printk("palacios: Could not locate graphics console data for extension GRAPHICS_CONSOLE_INTERFACE\n"); return 0; } @@ -246,7 +246,7 @@ static struct v3_graphics_console_hooks palacios_graphics_console_hooks = }; -static int gfx_console_init( void ) { +static int graphics_console_init( void ) { V3_Init_Graphics_Console(&palacios_graphics_console_hooks); @@ -351,27 +351,33 @@ static int fb_input(struct v3_guest * guest, } -static int gfx_console_guest_init(struct v3_guest * guest, void ** vm_data) { - struct palacios_graphics_console * gfx_cons = kmalloc(sizeof(struct palacios_graphics_console), GFP_KERNEL); +static int graphics_console_guest_init(struct v3_guest * guest, void ** vm_data) { + struct palacios_graphics_console * graphics_cons = kmalloc(sizeof(struct palacios_graphics_console), GFP_KERNEL); - memset(gfx_cons, 0, sizeof(struct palacios_graphics_console)); + if (!graphics_cons) { + printk("palacios: filed to do guest_init for graphics console\n"); + return -1; + } + + memset(graphics_cons, 0, sizeof(struct palacios_graphics_console)); + *vm_data = graphics_cons; - add_guest_ctrl(guest, V3_VM_FB_INPUT, fb_input, gfx_cons); - add_guest_ctrl(guest, V3_VM_FB_QUERY, fb_query, gfx_cons); + add_guest_ctrl(guest, V3_VM_FB_INPUT, fb_input, graphics_cons); + add_guest_ctrl(guest, V3_VM_FB_QUERY, fb_query, graphics_cons); return 0; } -static struct linux_ext gfx_cons_ext = { +static struct linux_ext graphics_cons_ext = { .name = "GRAPHICS_CONSOLE_INTERFACE", - .init = gfx_console_init, + .init = graphics_console_init, .deinit = NULL, - .guest_init = gfx_console_guest_init, + .guest_init = graphics_console_guest_init, .guest_deinit = NULL }; -register_extension(&gfx_cons_ext); +register_extension(&graphics_cons_ext); diff --git a/linux_module/palacios-host-dev.c b/linux_module/palacios-host-dev.c index e560889..927b5ad 100644 --- a/linux_module/palacios-host-dev.c +++ b/linux_module/palacios-host-dev.c @@ -1328,6 +1328,11 @@ static int host_dev_init( void ) { static int host_dev_guest_init(struct v3_guest * guest, void ** vm_data ) { struct palacios_host_dev * host_dev = kmalloc(sizeof(struct palacios_host_dev), GFP_KERNEL); + + if (!host_dev) { + ERROR("palacios: failed to do guest_init for host device\n"); + return -1; + } INIT_LIST_HEAD(&(host_dev->devs));