diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-04-22 05:57:40 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-05-07 06:41:56 -0400 |
commit | a7a97c639478941102e33dcdd0ff6d4b70539533 (patch) | |
tree | 92fa808bf42e87630922fa1e5befb80660b4f1f7 /drivers | |
parent | 7eb7ce4d2e8991aff4ecb71a81949a907ca755ac (diff) |
drivers/video/xen-fbfront.c: add missing cleanup code
The operations in the subsequent error-handling code appear to be also
useful here.
Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
[v1: Collapse some of the error handling functions]
[v2: Fix compile warning]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/xen-fbfront.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index cb4529c40d7..b7f5173ff9e 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -365,7 +365,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, | |||
365 | struct fb_info *fb_info; | 365 | struct fb_info *fb_info; |
366 | int fb_size; | 366 | int fb_size; |
367 | int val; | 367 | int val; |
368 | int ret; | 368 | int ret = 0; |
369 | 369 | ||
370 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 370 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
371 | if (info == NULL) { | 371 | if (info == NULL) { |
@@ -458,26 +458,31 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, | |||
458 | xenfb_init_shared_page(info, fb_info); | 458 | xenfb_init_shared_page(info, fb_info); |
459 | 459 | ||
460 | ret = xenfb_connect_backend(dev, info); | 460 | ret = xenfb_connect_backend(dev, info); |
461 | if (ret < 0) | 461 | if (ret < 0) { |
462 | goto error; | 462 | xenbus_dev_fatal(dev, ret, "xenfb_connect_backend"); |
463 | goto error_fb; | ||
464 | } | ||
463 | 465 | ||
464 | ret = register_framebuffer(fb_info); | 466 | ret = register_framebuffer(fb_info); |
465 | if (ret) { | 467 | if (ret) { |
466 | fb_deferred_io_cleanup(fb_info); | ||
467 | fb_dealloc_cmap(&fb_info->cmap); | ||
468 | framebuffer_release(fb_info); | ||
469 | xenbus_dev_fatal(dev, ret, "register_framebuffer"); | 468 | xenbus_dev_fatal(dev, ret, "register_framebuffer"); |
470 | goto error; | 469 | goto error_fb; |
471 | } | 470 | } |
472 | info->fb_info = fb_info; | 471 | info->fb_info = fb_info; |
473 | 472 | ||
474 | xenfb_make_preferred_console(); | 473 | xenfb_make_preferred_console(); |
475 | return 0; | 474 | return 0; |
476 | 475 | ||
477 | error_nomem: | 476 | error_fb: |
478 | ret = -ENOMEM; | 477 | fb_deferred_io_cleanup(fb_info); |
479 | xenbus_dev_fatal(dev, ret, "allocating device memory"); | 478 | fb_dealloc_cmap(&fb_info->cmap); |
480 | error: | 479 | framebuffer_release(fb_info); |
480 | error_nomem: | ||
481 | if (!ret) { | ||
482 | ret = -ENOMEM; | ||
483 | xenbus_dev_fatal(dev, ret, "allocating device memory"); | ||
484 | } | ||
485 | error: | ||
481 | xenfb_remove(dev); | 486 | xenfb_remove(dev); |
482 | return ret; | 487 | return ret; |
483 | } | 488 | } |