diff options
author | Ken Cox <jkc@redhat.com> | 2014-03-19 14:06:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-19 16:56:31 -0400 |
commit | d9355f8934a4c54d81a29ae7bd5ae4329c02aa48 (patch) | |
tree | ed936e07c564b1bde78452d67bcf93e3474d0151 | |
parent | 61e03b433d22d9473432e6427c505db986d4681d (diff) |
Staging: unisys: Remove RETPTR macro
The RETPTR macro contained a goto statement which is not allowed in
the kernel.
Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/unisys/include/timskmod.h | 4 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/uislib.c | 11 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/uisqueue.c | 1 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 3 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/parser.c | 36 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/memregion_direct.c | 9 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/procobjecttree.c | 22 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/visorkmodutils.c | 8 |
8 files changed, 55 insertions, 39 deletions
diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index 0623f55ec764..41cbcde7c15c 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h | |||
@@ -128,10 +128,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */ | |||
128 | * @param x the value to return | 128 | * @param x the value to return |
129 | */ | 129 | */ |
130 | #define RETINT(x) do { rc = (x); RETTRACE(x); goto Away; } while (0) | 130 | #define RETINT(x) do { rc = (x); RETTRACE(x); goto Away; } while (0) |
131 | /** return from a void* function, using a common exit point "Away" | ||
132 | * @param x the value to return | ||
133 | */ | ||
134 | #define RETPTR(x) do { rc = (x); RETTRACE(x); goto Away; } while (0) | ||
135 | /** Given a typedef/struct/union and a member field name, | 131 | /** Given a typedef/struct/union and a member field name, |
136 | * return the number of bytes occupied by that field. | 132 | * return the number of bytes occupied by that field. |
137 | * @param TYPE the typedef name, or "struct xx" or "union xx" | 133 | * @param TYPE the typedef name, or "struct xx" or "union xx" |
diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 1737f3ad007b..4f8a8081f8d0 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c | |||
@@ -270,24 +270,27 @@ init_vbus_channel(U64 channelAddr, U32 channelBytes, int isServer) | |||
270 | LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", | 270 | LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", |
271 | (unsigned long long) channelAddr, | 271 | (unsigned long long) channelAddr, |
272 | (unsigned long long) channelBytes); | 272 | (unsigned long long) channelBytes); |
273 | RETPTR(NULL); | 273 | rc = NULL; |
274 | goto Away; | ||
274 | } | 275 | } |
275 | if (isServer) { | 276 | if (isServer) { |
276 | memset_io(pChan, 0, channelBytes); | 277 | memset_io(pChan, 0, channelBytes); |
277 | if (!ULTRA_VBUS_CHANNEL_OK_SERVER(channelBytes, NULL)) { | 278 | if (!ULTRA_VBUS_CHANNEL_OK_SERVER(channelBytes, NULL)) { |
278 | ERRDRV("%s channel cannot be used", __func__); | 279 | ERRDRV("%s channel cannot be used", __func__); |
279 | uislib_iounmap(pChan); | 280 | uislib_iounmap(pChan); |
280 | RETPTR(NULL); | 281 | rc = NULL; |
282 | goto Away; | ||
281 | } | 283 | } |
282 | ULTRA_VBUS_init_channel(pChan, channelBytes); | 284 | ULTRA_VBUS_init_channel(pChan, channelBytes); |
283 | } else { | 285 | } else { |
284 | if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) { | 286 | if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) { |
285 | ERRDRV("%s channel cannot be used", __func__); | 287 | ERRDRV("%s channel cannot be used", __func__); |
286 | uislib_iounmap(pChan); | 288 | uislib_iounmap(pChan); |
287 | RETPTR(NULL); | 289 | rc = NULL; |
290 | goto Away; | ||
288 | } | 291 | } |
289 | } | 292 | } |
290 | RETPTR(pChan); | 293 | rc = pChan; |
291 | Away: | 294 | Away: |
292 | return rc; | 295 | return rc; |
293 | } | 296 | } |
diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c index 7ea306e52ba8..7bd05f7fe5ef 100644 --- a/drivers/staging/unisys/uislib/uisqueue.c +++ b/drivers/staging/unisys/uislib/uisqueue.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #define RETVOID do { goto Away; } while (0) | 31 | #define RETVOID do { goto Away; } while (0) |
32 | #define RETINT(x) do { rc = (x); goto Away; } while (0) | 32 | #define RETINT(x) do { rc = (x); goto Away; } while (0) |
33 | #define RETPTR(x) do { rc = (x); goto Away; } while (0) | ||
34 | 33 | ||
35 | #define CHECK_CACHE_ALIGN 0 | 34 | #define CHECK_CACHE_ALIGN 0 |
36 | 35 | ||
diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index ff4556b59262..99889fd2ea1e 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c | |||
@@ -89,8 +89,7 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, | |||
89 | p->size = channelBytes; | 89 | p->size = channelBytes; |
90 | p->guid = guid; | 90 | p->guid = guid; |
91 | 91 | ||
92 | RETPTR(p); | 92 | rc = p; |
93 | |||
94 | Away: | 93 | Away: |
95 | 94 | ||
96 | if (rc == NULL) { | 95 | if (rc == NULL) { |
diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index de0a4c23ffaf..6904dcce312b 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c | |||
@@ -63,7 +63,8 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal, | |||
63 | MAX_CONTROLVM_PAYLOAD_BYTES); | 63 | MAX_CONTROLVM_PAYLOAD_BYTES); |
64 | if (tryAgain) | 64 | if (tryAgain) |
65 | *tryAgain = TRUE; | 65 | *tryAgain = TRUE; |
66 | RETPTR(NULL); | 66 | rc = NULL; |
67 | goto Away; | ||
67 | } | 68 | } |
68 | ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); | 69 | ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); |
69 | if (ctx == NULL) { | 70 | if (ctx == NULL) { |
@@ -71,7 +72,8 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal, | |||
71 | __func__, __FILE__, __LINE__, allocbytes); | 72 | __func__, __FILE__, __LINE__, allocbytes); |
72 | if (tryAgain) | 73 | if (tryAgain) |
73 | *tryAgain = TRUE; | 74 | *tryAgain = TRUE; |
74 | RETPTR(NULL); | 75 | rc = NULL; |
76 | goto Away; | ||
75 | } | 77 | } |
76 | 78 | ||
77 | ctx->allocbytes = allocbytes; | 79 | ctx->allocbytes = allocbytes; |
@@ -85,45 +87,53 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal, | |||
85 | ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)", | 87 | ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)", |
86 | __func__, | 88 | __func__, |
87 | (unsigned long long) addr, (ulong) bytes); | 89 | (unsigned long long) addr, (ulong) bytes); |
88 | RETPTR(NULL); | 90 | rc = NULL; |
91 | goto Away; | ||
89 | } | 92 | } |
90 | p = __va((ulong) (addr)); | 93 | p = __va((ulong) (addr)); |
91 | memcpy(ctx->data, p, bytes); | 94 | memcpy(ctx->data, p, bytes); |
92 | } else { | 95 | } else { |
93 | rgn = visor_memregion_create(addr, bytes); | 96 | rgn = visor_memregion_create(addr, bytes); |
94 | if (!rgn) | 97 | if (!rgn) { |
95 | RETPTR(NULL); | 98 | rc = NULL; |
96 | if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) | 99 | goto Away; |
97 | RETPTR(NULL); | 100 | } |
101 | if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) { | ||
102 | rc = NULL; | ||
103 | goto Away; | ||
104 | } | ||
98 | } | 105 | } |
99 | if (!hasStandardPayloadHeader) { | 106 | if (!hasStandardPayloadHeader) { |
100 | ctx->byte_stream = TRUE; | 107 | ctx->byte_stream = TRUE; |
101 | RETPTR(ctx); | 108 | rc = ctx; |
109 | goto Away; | ||
102 | } | 110 | } |
103 | phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data); | 111 | phdr = (ULTRA_CONTROLVM_PARAMETERS_HEADER *) (ctx->data); |
104 | if (phdr->TotalLength != bytes) { | 112 | if (phdr->TotalLength != bytes) { |
105 | ERRDRV("%s - bad total length %lu (should be %lu)", | 113 | ERRDRV("%s - bad total length %lu (should be %lu)", |
106 | __func__, | 114 | __func__, |
107 | (ulong) (phdr->TotalLength), (ulong) (bytes)); | 115 | (ulong) (phdr->TotalLength), (ulong) (bytes)); |
108 | RETPTR(NULL); | 116 | rc = NULL; |
117 | goto Away; | ||
109 | } | 118 | } |
110 | if (phdr->TotalLength < phdr->HeaderLength) { | 119 | if (phdr->TotalLength < phdr->HeaderLength) { |
111 | ERRDRV("%s - total length < header length (%lu < %lu)", | 120 | ERRDRV("%s - total length < header length (%lu < %lu)", |
112 | __func__, | 121 | __func__, |
113 | (ulong) (phdr->TotalLength), | 122 | (ulong) (phdr->TotalLength), |
114 | (ulong) (phdr->HeaderLength)); | 123 | (ulong) (phdr->HeaderLength)); |
115 | RETPTR(NULL); | 124 | rc = NULL; |
125 | goto Away; | ||
116 | } | 126 | } |
117 | if (phdr->HeaderLength < sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)) { | 127 | if (phdr->HeaderLength < sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER)) { |
118 | ERRDRV("%s - header is too small (%lu < %lu)", | 128 | ERRDRV("%s - header is too small (%lu < %lu)", |
119 | __func__, | 129 | __func__, |
120 | (ulong) (phdr->HeaderLength), | 130 | (ulong) (phdr->HeaderLength), |
121 | (ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER))); | 131 | (ulong) (sizeof(ULTRA_CONTROLVM_PARAMETERS_HEADER))); |
122 | RETPTR(NULL); | 132 | rc = NULL; |
133 | goto Away; | ||
123 | } | 134 | } |
124 | 135 | ||
125 | RETPTR(ctx); | 136 | rc = ctx; |
126 | |||
127 | Away: | 137 | Away: |
128 | if (rgn) { | 138 | if (rgn) { |
129 | visor_memregion_destroy(rgn); | 139 | visor_memregion_destroy(rgn); |
diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index b9b61e8a8e71..2c1061d55ee9 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c | |||
@@ -50,10 +50,11 @@ visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) | |||
50 | memregion->physaddr = physaddr; | 50 | memregion->physaddr = physaddr; |
51 | memregion->nbytes = nbytes; | 51 | memregion->nbytes = nbytes; |
52 | memregion->overlapped = FALSE; | 52 | memregion->overlapped = FALSE; |
53 | if (!mapit(memregion)) | 53 | if (!mapit(memregion)) { |
54 | RETPTR(NULL); | 54 | rc = NULL; |
55 | RETPTR(memregion); | 55 | goto Away; |
56 | 56 | } | |
57 | rc = memregion; | ||
57 | Away: | 58 | Away: |
58 | if (rc == NULL) { | 59 | if (rc == NULL) { |
59 | if (memregion != NULL) { | 60 | if (memregion != NULL) { |
diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index 1da9958a08c6..6a082b952066 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c | |||
@@ -162,12 +162,14 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, | |||
162 | parent = procDirRoot; | 162 | parent = procDirRoot; |
163 | for (i = 0; i < type->nNames; i++) { | 163 | for (i = 0; i < type->nNames; i++) { |
164 | type->procDirs[i] = createProcDir(type->name[i], parent); | 164 | type->procDirs[i] = createProcDir(type->name[i], parent); |
165 | if (type->procDirs[i] == NULL) | 165 | if (type->procDirs[i] == NULL) { |
166 | RETPTR(NULL); | 166 | rc = NULL; |
167 | goto Away; | ||
168 | } | ||
167 | parent = type->procDirs[i]; | 169 | parent = type->procDirs[i]; |
168 | } | 170 | } |
169 | type->procDir = type->procDirs[type->nNames-1]; | 171 | type->procDir = type->procDirs[type->nNames-1]; |
170 | RETPTR(type); | 172 | rc = type; |
171 | Away: | 173 | Away: |
172 | if (rc == NULL) { | 174 | if (rc == NULL) { |
173 | if (type != NULL) { | 175 | if (type != NULL) { |
@@ -232,8 +234,10 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, | |||
232 | } | 234 | } |
233 | strcpy(obj->name, name); | 235 | strcpy(obj->name, name); |
234 | obj->procDir = createProcDir(obj->name, type->procDir); | 236 | obj->procDir = createProcDir(obj->name, type->procDir); |
235 | if (obj->procDir == NULL) | 237 | if (obj->procDir == NULL) { |
236 | RETPTR(NULL); | 238 | rc = NULL; |
239 | goto Away; | ||
240 | } | ||
237 | } | 241 | } |
238 | obj->procDirPropertyContexts = | 242 | obj->procDirPropertyContexts = |
239 | kzalloc((type->nProperties + 1) * sizeof(PROCDIRENTRYCONTEXT), | 243 | kzalloc((type->nProperties + 1) * sizeof(PROCDIRENTRYCONTEXT), |
@@ -256,11 +260,13 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, | |||
256 | createProcFile(type->propertyNames[i], | 260 | createProcFile(type->propertyNames[i], |
257 | obj->procDir, &proc_fops, | 261 | obj->procDir, &proc_fops, |
258 | &obj->procDirPropertyContexts[i]); | 262 | &obj->procDirPropertyContexts[i]); |
259 | if (obj->procDirProperties[i] == NULL) | 263 | if (obj->procDirProperties[i] == NULL) { |
260 | RETPTR(NULL); | 264 | rc = NULL; |
265 | goto Away; | ||
266 | } | ||
261 | } | 267 | } |
262 | } | 268 | } |
263 | RETPTR(obj); | 269 | rc = obj; |
264 | Away: | 270 | Away: |
265 | if (rc == NULL) { | 271 | if (rc == NULL) { |
266 | if (obj != NULL) { | 272 | if (obj != NULL) { |
diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c index ef064692e2fe..a7d1e94ca3c3 100644 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ b/drivers/staging/unisys/visorutil/visorkmodutils.c | |||
@@ -43,12 +43,14 @@ struct seq_file *visor_seq_file_new_buffer(void *buf, size_t buf_size) | |||
43 | struct seq_file *rc = NULL; | 43 | struct seq_file *rc = NULL; |
44 | struct seq_file *m = kmalloc_kernel(sizeof(struct seq_file)); | 44 | struct seq_file *m = kmalloc_kernel(sizeof(struct seq_file)); |
45 | 45 | ||
46 | if (m == NULL) | 46 | if (m == NULL) { |
47 | RETPTR(NULL); | 47 | rc = NULL; |
48 | goto Away; | ||
49 | } | ||
48 | memset(m, 0, sizeof(struct seq_file)); | 50 | memset(m, 0, sizeof(struct seq_file)); |
49 | m->buf = buf; | 51 | m->buf = buf; |
50 | m->size = buf_size; | 52 | m->size = buf_size; |
51 | RETPTR(m); | 53 | rc = m; |
52 | Away: | 54 | Away: |
53 | if (rc == NULL) { | 55 | if (rc == NULL) { |
54 | visor_seq_file_done_buffer(m); | 56 | visor_seq_file_done_buffer(m); |