-
Notifications
You must be signed in to change notification settings - Fork 2
/
Fix-compile-warnings-ignoring-return-value-of-xenb.patch
86 lines (71 loc) · 2.4 KB
/
Fix-compile-warnings-ignoring-return-value-of-xenb.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 0c989045948320d583a190b75a12ba0ec556b804 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Thu, 8 Oct 2009 13:23:09 -0400
Subject: [PATCH] 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 <[email protected]>
Signed-off-by: Jeremy Fitzhardinge <[email protected]>
---
drivers/xen/netback/common.h | 2 +-
drivers/xen/netback/netback.c | 12 +++++++++++-
drivers/xen/netback/xenbus.c | 4 ++--
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/xen/netback/common.h b/drivers/xen/netback/common.h
index b15a7e1..348644a 100644
--- a/drivers/xen/netback/common.h
+++ b/drivers/xen/netback/common.h
@@ -196,7 +196,7 @@ static inline void netif_put(struct xen_netif *netif)
wake_up(&netif->waiting_to_free);
}
-void netif_xenbus_init(void);
+int netif_xenbus_init(void);
#define netif_schedulable(netif) \
(netif_running((netif)->dev) && netback_carrier_ok(netif))
diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c
index 2331f63..3f59233 100644
--- a/drivers/xen/netback/netback.c
+++ b/drivers/xen/netback/netback.c
@@ -1558,6 +1558,7 @@ static int __init netback_init(void)
{
int i;
struct page *page;
+ int rc = 0;
if (!xen_domain())
return -ENODEV;
@@ -1605,7 +1606,9 @@ static int __init netback_init(void)
//netif_accel_init();
- netif_xenbus_init();
+ rc = netif_xenbus_init();
+ if (rc)
+ goto failed_init;
#ifdef NETBE_DEBUG_INTERRUPT
(void)bind_virq_to_irqhandler(VIRQ_DEBUG,
@@ -1617,6 +1620,13 @@ static int __init netback_init(void)
#endif
return 0;
+
+failed_init:
+ free_empty_pages_and_pagevec(mmap_pages, MAX_PENDING_REQS);
+ del_timer(&netbk_tx_pending_timer);
+ del_timer(&net_timer);
+ return rc;
+
}
module_init(netback_init);
diff --git a/drivers/xen/netback/xenbus.c b/drivers/xen/netback/xenbus.c
index 3d8ed9a..7a27dad 100644
--- a/drivers/xen/netback/xenbus.c
+++ b/drivers/xen/netback/xenbus.c
@@ -463,8 +463,7 @@ static struct xenbus_driver netback = {
};
-void netif_xenbus_init(void)
+int netif_xenbus_init(void)
{
- if (xenbus_register_backend(&netback))
- BUG();
+ return xenbus_register_backend(&netback);
}
--
1.5.6.5