diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2009-10-08 13:23:09 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-04-14 18:26:07 -0400 |
commit | 8770b2683f9f98d4c1d6caf2e28f625592bba4f3 (patch) | |
tree | c0802accb3d22c29aaba1dc6428b0d77458a9897 | |
parent | afd91d07ff72919071e37086c0664384b3875688 (diff) |
Fix compile warnings: ignoring return value of 'xenbus_register_backend' ..
We neglect to check the return value of xenbus_register_backend
and take actions when that fails. This patch fixes that and adds
code to deal with those type of failures.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
-rw-r--r-- | drivers/xen/blkback/blkback.c | 18 | ||||
-rw-r--r-- | drivers/xen/blkback/common.h | 4 | ||||
-rw-r--r-- | drivers/xen/blkback/interface.c | 6 | ||||
-rw-r--r-- | drivers/xen/blkback/xenbus.c | 5 |
4 files changed, 22 insertions, 11 deletions
diff --git a/drivers/xen/blkback/blkback.c b/drivers/xen/blkback/blkback.c index e9e3de119a73..a2ac7189cc0a 100644 --- a/drivers/xen/blkback/blkback.c +++ b/drivers/xen/blkback/blkback.c | |||
@@ -614,6 +614,7 @@ static void make_response(blkif_t *blkif, u64 id, | |||
614 | static int __init blkif_init(void) | 614 | static int __init blkif_init(void) |
615 | { | 615 | { |
616 | int i, mmap_pages; | 616 | int i, mmap_pages; |
617 | int rc = 0; | ||
617 | 618 | ||
618 | if (!xen_pv_domain()) | 619 | if (!xen_pv_domain()) |
619 | return -ENODEV; | 620 | return -ENODEV; |
@@ -626,13 +627,17 @@ static int __init blkif_init(void) | |||
626 | mmap_pages, GFP_KERNEL); | 627 | mmap_pages, GFP_KERNEL); |
627 | pending_pages = alloc_empty_pages_and_pagevec(mmap_pages); | 628 | pending_pages = alloc_empty_pages_and_pagevec(mmap_pages); |
628 | 629 | ||
629 | if (!pending_reqs || !pending_grant_handles || !pending_pages) | 630 | if (!pending_reqs || !pending_grant_handles || !pending_pages) { |
631 | rc = -ENOMEM; | ||
630 | goto out_of_memory; | 632 | goto out_of_memory; |
633 | } | ||
631 | 634 | ||
632 | for (i = 0; i < mmap_pages; i++) | 635 | for (i = 0; i < mmap_pages; i++) |
633 | pending_grant_handles[i] = BLKBACK_INVALID_HANDLE; | 636 | pending_grant_handles[i] = BLKBACK_INVALID_HANDLE; |
634 | 637 | ||
635 | blkif_interface_init(); | 638 | rc = blkif_interface_init(); |
639 | if (rc) | ||
640 | goto failed_init; | ||
636 | 641 | ||
637 | memset(pending_reqs, 0, sizeof(pending_reqs)); | 642 | memset(pending_reqs, 0, sizeof(pending_reqs)); |
638 | INIT_LIST_HEAD(&pending_free); | 643 | INIT_LIST_HEAD(&pending_free); |
@@ -640,16 +645,19 @@ static int __init blkif_init(void) | |||
640 | for (i = 0; i < blkif_reqs; i++) | 645 | for (i = 0; i < blkif_reqs; i++) |
641 | list_add_tail(&pending_reqs[i].free_list, &pending_free); | 646 | list_add_tail(&pending_reqs[i].free_list, &pending_free); |
642 | 647 | ||
643 | blkif_xenbus_init(); | 648 | rc = blkif_xenbus_init(); |
649 | if (rc) | ||
650 | goto failed_init; | ||
644 | 651 | ||
645 | return 0; | 652 | return 0; |
646 | 653 | ||
647 | out_of_memory: | 654 | out_of_memory: |
655 | printk(KERN_ERR "%s: out of memory\n", __func__); | ||
656 | failed_init: | ||
648 | kfree(pending_reqs); | 657 | kfree(pending_reqs); |
649 | kfree(pending_grant_handles); | 658 | kfree(pending_grant_handles); |
650 | free_empty_pages_and_pagevec(pending_pages, mmap_pages); | 659 | free_empty_pages_and_pagevec(pending_pages, mmap_pages); |
651 | printk("%s: out of memory\n", __FUNCTION__); | 660 | return rc; |
652 | return -ENOMEM; | ||
653 | } | 661 | } |
654 | 662 | ||
655 | module_init(blkif_init); | 663 | module_init(blkif_init); |
diff --git a/drivers/xen/blkback/common.h b/drivers/xen/blkback/common.h index 57b78250cfb7..aaf36485bc01 100644 --- a/drivers/xen/blkback/common.h +++ b/drivers/xen/blkback/common.h | |||
@@ -124,9 +124,9 @@ struct phys_req { | |||
124 | 124 | ||
125 | int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation); | 125 | int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation); |
126 | 126 | ||
127 | void blkif_interface_init(void); | 127 | int blkif_interface_init(void); |
128 | 128 | ||
129 | void blkif_xenbus_init(void); | 129 | int blkif_xenbus_init(void); |
130 | 130 | ||
131 | irqreturn_t blkif_be_int(int irq, void *dev_id); | 131 | irqreturn_t blkif_be_int(int irq, void *dev_id); |
132 | int blkif_schedule(void *arg); | 132 | int blkif_schedule(void *arg); |
diff --git a/drivers/xen/blkback/interface.c b/drivers/xen/blkback/interface.c index c6c3e14776b9..e397a4134f1b 100644 --- a/drivers/xen/blkback/interface.c +++ b/drivers/xen/blkback/interface.c | |||
@@ -175,8 +175,12 @@ void blkif_free(blkif_t *blkif) | |||
175 | kmem_cache_free(blkif_cachep, blkif); | 175 | kmem_cache_free(blkif_cachep, blkif); |
176 | } | 176 | } |
177 | 177 | ||
178 | void __init blkif_interface_init(void) | 178 | int __init blkif_interface_init(void) |
179 | { | 179 | { |
180 | blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t), | 180 | blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t), |
181 | 0, 0, NULL); | 181 | 0, 0, NULL); |
182 | if (!blkif_cachep) | ||
183 | return -ENOMEM; | ||
184 | |||
185 | return 0; | ||
182 | } | 186 | } |
diff --git a/drivers/xen/blkback/xenbus.c b/drivers/xen/blkback/xenbus.c index 650f4b3e9b3c..04c0a12aff36 100644 --- a/drivers/xen/blkback/xenbus.c +++ b/drivers/xen/blkback/xenbus.c | |||
@@ -535,8 +535,7 @@ static struct xenbus_driver blkback = { | |||
535 | }; | 535 | }; |
536 | 536 | ||
537 | 537 | ||
538 | void blkif_xenbus_init(void) | 538 | int blkif_xenbus_init(void) |
539 | { | 539 | { |
540 | /* XXX must_check */ | 540 | return xenbus_register_backend(&blkback); |
541 | (void)xenbus_register_backend(&blkback); | ||
542 | } | 541 | } |