diff options
author | Ken Cox <jkc@redhat.com> | 2014-03-19 14:06:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-19 16:56:31 -0400 |
commit | 22ad57ba5eacf2611a086379aaa18e456bf2ffbc (patch) | |
tree | 839e3be8de9fc5a7192b3a063d68bc42d1cbdc5f | |
parent | 5e54c97dab0298cf5479bc1f2d3f42ef5605ce6e (diff) |
Staging: unisys: Remove RETINT macro
The RETINT macro included 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/uisqueue.c | 9 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 10 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/file.c | 33 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/visorchipset_main.c | 62 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/charqueue.c | 11 |
6 files changed, 68 insertions, 61 deletions
diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index 3f8e6a2fd8c7..5fd5ad514464 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h | |||
@@ -122,10 +122,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */ | |||
122 | #define RETTRACE(x) | 122 | #define RETTRACE(x) |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | /** return from an int function, using a common exit point "Away" | ||
126 | * @param x the value to return | ||
127 | */ | ||
128 | #define RETINT(x) do { rc = (x); RETTRACE(x); goto Away; } while (0) | ||
129 | /** Try to evaulate the provided expression, and do a RETINT(x) iff | 125 | /** Try to evaulate the provided expression, and do a RETINT(x) iff |
130 | * the expression evaluates to < 0. | 126 | * the expression evaluates to < 0. |
131 | * @param x the expression to try | 127 | * @param x the expression to try |
diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c index 91b03ed829ef..40598ff1f4f2 100644 --- a/drivers/staging/unisys/uislib/uisqueue.c +++ b/drivers/staging/unisys/uislib/uisqueue.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #define CURRENT_FILE_PC UISLIB_PC_uisqueue_c | 28 | #define CURRENT_FILE_PC UISLIB_PC_uisqueue_c |
29 | #define __MYFILE__ "uisqueue.c" | 29 | #define __MYFILE__ "uisqueue.c" |
30 | 30 | ||
31 | #define RETINT(x) do { rc = (x); goto Away; } while (0) | ||
32 | |||
33 | #define CHECK_CACHE_ALIGN 0 | 31 | #define CHECK_CACHE_ALIGN 0 |
34 | 32 | ||
35 | /*****************************************************/ | 33 | /*****************************************************/ |
@@ -91,13 +89,13 @@ do_locked_client_insert(struct uisqueue_info *queueinfo, | |||
91 | locked = 1; | 89 | locked = 1; |
92 | 90 | ||
93 | if (!ULTRA_CHANNEL_CLIENT_ACQUIRE_OS(queueinfo->chan, channelId, NULL)) | 91 | if (!ULTRA_CHANNEL_CLIENT_ACQUIRE_OS(queueinfo->chan, channelId, NULL)) |
94 | RETINT(0); | 92 | goto Away; |
95 | 93 | ||
96 | acquired = 1; | 94 | acquired = 1; |
97 | 95 | ||
98 | queueWasEmpty = visor_signalqueue_empty(queueinfo->chan, whichqueue); | 96 | queueWasEmpty = visor_signalqueue_empty(queueinfo->chan, whichqueue); |
99 | if (!visor_signal_insert(queueinfo->chan, whichqueue, pSignal)) | 97 | if (!visor_signal_insert(queueinfo->chan, whichqueue, pSignal)) |
100 | RETINT(0); | 98 | goto Away; |
101 | ULTRA_CHANNEL_CLIENT_RELEASE_OS(queueinfo->chan, channelId, NULL); | 99 | ULTRA_CHANNEL_CLIENT_RELEASE_OS(queueinfo->chan, channelId, NULL); |
102 | acquired = 0; | 100 | acquired = 0; |
103 | spin_unlock_irqrestore(lock, flags); | 101 | spin_unlock_irqrestore(lock, flags); |
@@ -105,8 +103,7 @@ do_locked_client_insert(struct uisqueue_info *queueinfo, | |||
105 | 103 | ||
106 | queueinfo->packets_sent++; | 104 | queueinfo->packets_sent++; |
107 | 105 | ||
108 | RETINT(1); | 106 | rc = 1; |
109 | |||
110 | Away: | 107 | Away: |
111 | if (acquired) { | 108 | if (acquired) { |
112 | ULTRA_CHANNEL_CLIENT_RELEASE_OS(queueinfo->chan, channelId, | 109 | ULTRA_CHANNEL_CLIENT_RELEASE_OS(queueinfo->chan, channelId, |
diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 8a200af3f0c8..053681616ba3 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c | |||
@@ -250,7 +250,7 @@ visorchannel_clear(VISORCHANNEL *channel, ulong offset, U8 ch, ulong nbytes) | |||
250 | 250 | ||
251 | if (buf == NULL) { | 251 | if (buf == NULL) { |
252 | ERRDRV("%s failed memory allocation", __func__); | 252 | ERRDRV("%s failed memory allocation", __func__); |
253 | RETINT(-1); | 253 | goto Away; |
254 | } | 254 | } |
255 | memset(buf, ch, bufsize); | 255 | memset(buf, ch, bufsize); |
256 | while (nbytes > 0) { | 256 | while (nbytes > 0) { |
@@ -260,12 +260,14 @@ visorchannel_clear(VISORCHANNEL *channel, ulong offset, U8 ch, ulong nbytes) | |||
260 | thisbytes = nbytes; | 260 | thisbytes = nbytes; |
261 | x = visor_memregion_write(channel->memregion, offset + written, | 261 | x = visor_memregion_write(channel->memregion, offset + written, |
262 | buf, thisbytes); | 262 | buf, thisbytes); |
263 | if (x < 0) | 263 | if (x < 0) { |
264 | RETINT(x); | 264 | rc = x; |
265 | goto Away; | ||
266 | } | ||
265 | written += thisbytes; | 267 | written += thisbytes; |
266 | nbytes -= thisbytes; | 268 | nbytes -= thisbytes; |
267 | } | 269 | } |
268 | RETINT(0); | 270 | rc = 0; |
269 | 271 | ||
270 | Away: | 272 | Away: |
271 | if (buf != NULL) { | 273 | if (buf != NULL) { |
diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 839a943a52c8..e214a1153282 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c | |||
@@ -71,7 +71,7 @@ visorchipset_file_init(dev_t majorDev, VISORCHANNEL **pControlVm_channel) | |||
71 | if (alloc_chrdev_region(&MajorDev, 0, 1, MYDRVNAME) < 0) { | 71 | if (alloc_chrdev_region(&MajorDev, 0, 1, MYDRVNAME) < 0) { |
72 | ERRDRV("Unable to allocate+register char device %s", | 72 | ERRDRV("Unable to allocate+register char device %s", |
73 | MYDRVNAME); | 73 | MYDRVNAME); |
74 | RETINT(-1); | 74 | goto Away; |
75 | } | 75 | } |
76 | Registered = TRUE; | 76 | Registered = TRUE; |
77 | INFODRV("New major number %d registered\n", MAJOR(MajorDev)); | 77 | INFODRV("New major number %d registered\n", MAJOR(MajorDev)); |
@@ -79,19 +79,18 @@ visorchipset_file_init(dev_t majorDev, VISORCHANNEL **pControlVm_channel) | |||
79 | /* static major device number registration required */ | 79 | /* static major device number registration required */ |
80 | if (register_chrdev_region(MajorDev, 1, MYDRVNAME) < 0) { | 80 | if (register_chrdev_region(MajorDev, 1, MYDRVNAME) < 0) { |
81 | ERRDRV("Unable to register char device %s", MYDRVNAME); | 81 | ERRDRV("Unable to register char device %s", MYDRVNAME); |
82 | RETINT(-1); | 82 | goto Away; |
83 | } | 83 | } |
84 | Registered = TRUE; | 84 | Registered = TRUE; |
85 | INFODRV("Static major number %d registered\n", MAJOR(MajorDev)); | 85 | INFODRV("Static major number %d registered\n", MAJOR(MajorDev)); |
86 | } | 86 | } |
87 | if (cdev_add(&Cdev, MKDEV(MAJOR(MajorDev), 0), 1) < 0) { | 87 | if (cdev_add(&Cdev, MKDEV(MAJOR(MajorDev), 0), 1) < 0) { |
88 | ERRDRV("failed to create char device: (status=-1)\n"); | 88 | ERRDRV("failed to create char device: (status=%d)\n", rc); |
89 | rc = -1; | ||
90 | goto Away; | 89 | goto Away; |
91 | } | 90 | } |
92 | INFODRV("Registered char device for %s (major=%d)", | 91 | INFODRV("Registered char device for %s (major=%d)", |
93 | MYDRVNAME, MAJOR(MajorDev)); | 92 | MYDRVNAME, MAJOR(MajorDev)); |
94 | RETINT(0); | 93 | rc = 0; |
95 | Away: | 94 | Away: |
96 | return rc; | 95 | return rc; |
97 | } | 96 | } |
@@ -119,9 +118,9 @@ visorchipset_open(struct inode *inode, struct file *file) | |||
119 | 118 | ||
120 | DEBUGDRV("%s", __func__); | 119 | DEBUGDRV("%s", __func__); |
121 | if (minor_number != 0) | 120 | if (minor_number != 0) |
122 | RETINT(-ENODEV); | 121 | goto Away; |
123 | file->private_data = NULL; | 122 | file->private_data = NULL; |
124 | RETINT(0); | 123 | rc = 0; |
125 | Away: | 124 | Away: |
126 | if (rc < 0) | 125 | if (rc < 0) |
127 | ERRDRV("%s minor=%d failed", __func__, minor_number); | 126 | ERRDRV("%s minor=%d failed", __func__, minor_number); |
@@ -131,11 +130,8 @@ Away: | |||
131 | static int | 130 | static int |
132 | visorchipset_release(struct inode *inode, struct file *file) | 131 | visorchipset_release(struct inode *inode, struct file *file) |
133 | { | 132 | { |
134 | int rc = -1; | ||
135 | DEBUGDRV("%s", __func__); | 133 | DEBUGDRV("%s", __func__); |
136 | RETINT(0); | 134 | return 0; |
137 | Away: | ||
138 | return rc; | ||
139 | } | 135 | } |
140 | 136 | ||
141 | static int | 137 | static int |
@@ -202,25 +198,28 @@ visorchipset_ioctl(struct inode *inode, struct file *file, | |||
202 | /* get the physical rtc offset */ | 198 | /* get the physical rtc offset */ |
203 | vrtc_offset = Issue_VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET(); | 199 | vrtc_offset = Issue_VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET(); |
204 | if (copy_to_user | 200 | if (copy_to_user |
205 | ((void __user *)arg, &vrtc_offset, sizeof(vrtc_offset))) | 201 | ((void __user *)arg, &vrtc_offset, sizeof(vrtc_offset))) { |
206 | RETINT(-EFAULT); | 202 | rc = -EFAULT; |
203 | goto Away; | ||
204 | } | ||
207 | DBGINF("insde visorchipset_ioctl, cmd=%d, vrtc_offset=%lld", | 205 | DBGINF("insde visorchipset_ioctl, cmd=%d, vrtc_offset=%lld", |
208 | cmd, vrtc_offset); | 206 | cmd, vrtc_offset); |
209 | break; | 207 | break; |
210 | case VMCALL_UPDATE_PHYSICAL_TIME: | 208 | case VMCALL_UPDATE_PHYSICAL_TIME: |
211 | if (copy_from_user | 209 | if (copy_from_user |
212 | (&adjustment, (void __user *)arg, sizeof(adjustment))) | 210 | (&adjustment, (void __user *)arg, sizeof(adjustment))) { |
213 | RETINT(-EFAULT); | 211 | rc = -EFAULT; |
212 | goto Away; | ||
213 | } | ||
214 | DBGINF("insde visorchipset_ioctl, cmd=%d, adjustment=%lld", cmd, | 214 | DBGINF("insde visorchipset_ioctl, cmd=%d, adjustment=%lld", cmd, |
215 | adjustment); | 215 | adjustment); |
216 | rc = Issue_VMCALL_UPDATE_PHYSICAL_TIME(adjustment); | 216 | rc = Issue_VMCALL_UPDATE_PHYSICAL_TIME(adjustment); |
217 | break; | 217 | break; |
218 | default: | 218 | default: |
219 | LOGERR("visorchipset_ioctl received invalid command"); | 219 | LOGERR("visorchipset_ioctl received invalid command"); |
220 | RETINT(-EFAULT); | 220 | rc = -EFAULT; |
221 | break; | 221 | break; |
222 | } | 222 | } |
223 | RETINT(rc); | ||
224 | Away: | 223 | Away: |
225 | DBGINF("exiting %d!", rc); | 224 | DBGINF("exiting %d!", rc); |
226 | return rc; | 225 | return rc; |
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index b2355d930488..8252ca14695d 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c | |||
@@ -631,7 +631,8 @@ chipset_init(CONTROLVM_MESSAGE *inmsg) | |||
631 | POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO); | 631 | POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO); |
632 | if (chipset_inited) { | 632 | if (chipset_inited) { |
633 | LOGERR("CONTROLVM_CHIPSET_INIT Failed: Already Done."); | 633 | LOGERR("CONTROLVM_CHIPSET_INIT Failed: Already Done."); |
634 | RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE); | 634 | rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; |
635 | goto Away; | ||
635 | } | 636 | } |
636 | chipset_inited = 1; | 637 | chipset_inited = 1; |
637 | POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO); | 638 | POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO); |
@@ -1079,7 +1080,8 @@ bus_create(CONTROLVM_MESSAGE *inmsg) | |||
1079 | busNo); | 1080 | busNo); |
1080 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, | 1081 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, |
1081 | POSTCODE_SEVERITY_ERR); | 1082 | POSTCODE_SEVERITY_ERR); |
1082 | RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE); | 1083 | rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; |
1084 | goto Away; | ||
1083 | } | 1085 | } |
1084 | pBusInfo = kzalloc(sizeof(VISORCHIPSET_BUS_INFO), GFP_KERNEL); | 1086 | pBusInfo = kzalloc(sizeof(VISORCHIPSET_BUS_INFO), GFP_KERNEL); |
1085 | if (pBusInfo == NULL) { | 1087 | if (pBusInfo == NULL) { |
@@ -1087,7 +1089,8 @@ bus_create(CONTROLVM_MESSAGE *inmsg) | |||
1087 | busNo); | 1089 | busNo); |
1088 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, | 1090 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, |
1089 | POSTCODE_SEVERITY_ERR); | 1091 | POSTCODE_SEVERITY_ERR); |
1090 | RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED); | 1092 | rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; |
1093 | goto Away; | ||
1091 | } | 1094 | } |
1092 | 1095 | ||
1093 | INIT_LIST_HEAD(&pBusInfo->entry); | 1096 | INIT_LIST_HEAD(&pBusInfo->entry); |
@@ -1127,12 +1130,14 @@ bus_destroy(CONTROLVM_MESSAGE *inmsg) | |||
1127 | pBusInfo = findbus(&BusInfoList, busNo); | 1130 | pBusInfo = findbus(&BusInfoList, busNo); |
1128 | if (!pBusInfo) { | 1131 | if (!pBusInfo) { |
1129 | LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu invalid", busNo); | 1132 | LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu invalid", busNo); |
1130 | RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID); | 1133 | rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; |
1134 | goto Away; | ||
1131 | } | 1135 | } |
1132 | if (pBusInfo->state.created == 0) { | 1136 | if (pBusInfo->state.created == 0) { |
1133 | LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu already destroyed", | 1137 | LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu already destroyed", |
1134 | busNo); | 1138 | busNo); |
1135 | RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE); | 1139 | rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; |
1140 | goto Away; | ||
1136 | } | 1141 | } |
1137 | 1142 | ||
1138 | Away: | 1143 | Away: |
@@ -1158,14 +1163,16 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx) | |||
1158 | busNo); | 1163 | busNo); |
1159 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, | 1164 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, |
1160 | POSTCODE_SEVERITY_ERR); | 1165 | POSTCODE_SEVERITY_ERR); |
1161 | RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID); | 1166 | rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; |
1167 | goto Away; | ||
1162 | } | 1168 | } |
1163 | if (pBusInfo->state.created == 0) { | 1169 | if (pBusInfo->state.created == 0) { |
1164 | LOGERR("CONTROLVM_BUS_CONFIGURE Failed: Invalid bus %lu - not created yet", | 1170 | LOGERR("CONTROLVM_BUS_CONFIGURE Failed: Invalid bus %lu - not created yet", |
1165 | busNo); | 1171 | busNo); |
1166 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, | 1172 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, |
1167 | POSTCODE_SEVERITY_ERR); | 1173 | POSTCODE_SEVERITY_ERR); |
1168 | RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID); | 1174 | rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; |
1175 | goto Away; | ||
1169 | } | 1176 | } |
1170 | /* TBD - add this check to other commands also... */ | 1177 | /* TBD - add this check to other commands also... */ |
1171 | if (pBusInfo->pendingMsgHdr.Id != CONTROLVM_INVALID) { | 1178 | if (pBusInfo->pendingMsgHdr.Id != CONTROLVM_INVALID) { |
@@ -1173,7 +1180,8 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx) | |||
1173 | busNo, (uint) pBusInfo->pendingMsgHdr.Id); | 1180 | busNo, (uint) pBusInfo->pendingMsgHdr.Id); |
1174 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, | 1181 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, |
1175 | POSTCODE_SEVERITY_ERR); | 1182 | POSTCODE_SEVERITY_ERR); |
1176 | RETINT(-CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT); | 1183 | rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT; |
1184 | goto Away; | ||
1177 | } | 1185 | } |
1178 | 1186 | ||
1179 | pBusInfo->partitionHandle = cmd->configureBus.guestHandle; | 1187 | pBusInfo->partitionHandle = cmd->configureBus.guestHandle; |
@@ -1189,7 +1197,8 @@ bus_configure(CONTROLVM_MESSAGE *inmsg, PARSER_CONTEXT *parser_ctx) | |||
1189 | busNo); | 1197 | busNo); |
1190 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, | 1198 | POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, |
1191 | POSTCODE_SEVERITY_ERR); | 1199 | POSTCODE_SEVERITY_ERR); |
1192 | RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED); | 1200 | rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; |
1201 | goto Away; | ||
1193 | } | 1202 | } |
1194 | POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); | 1203 | POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); |
1195 | Away: | 1204 | Away: |
@@ -1213,7 +1222,8 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) | |||
1213 | busNo, devNo); | 1222 | busNo, devNo); |
1214 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, | 1223 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, |
1215 | POSTCODE_SEVERITY_ERR); | 1224 | POSTCODE_SEVERITY_ERR); |
1216 | RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE); | 1225 | rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; |
1226 | goto Away; | ||
1217 | } | 1227 | } |
1218 | pBusInfo = findbus(&BusInfoList, busNo); | 1228 | pBusInfo = findbus(&BusInfoList, busNo); |
1219 | if (!pBusInfo) { | 1229 | if (!pBusInfo) { |
@@ -1221,14 +1231,16 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) | |||
1221 | busNo); | 1231 | busNo); |
1222 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, | 1232 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, |
1223 | POSTCODE_SEVERITY_ERR); | 1233 | POSTCODE_SEVERITY_ERR); |
1224 | RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID); | 1234 | rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; |
1235 | goto Away; | ||
1225 | } | 1236 | } |
1226 | if (pBusInfo->state.created == 0) { | 1237 | if (pBusInfo->state.created == 0) { |
1227 | LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - not created yet", | 1238 | LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - not created yet", |
1228 | busNo); | 1239 | busNo); |
1229 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, | 1240 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, |
1230 | POSTCODE_SEVERITY_ERR); | 1241 | POSTCODE_SEVERITY_ERR); |
1231 | RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID); | 1242 | rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; |
1243 | goto Away; | ||
1232 | } | 1244 | } |
1233 | pDevInfo = kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL); | 1245 | pDevInfo = kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL); |
1234 | if (pDevInfo == NULL) { | 1246 | if (pDevInfo == NULL) { |
@@ -1236,7 +1248,8 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) | |||
1236 | busNo, devNo); | 1248 | busNo, devNo); |
1237 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, | 1249 | POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, |
1238 | POSTCODE_SEVERITY_ERR); | 1250 | POSTCODE_SEVERITY_ERR); |
1239 | RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED); | 1251 | rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; |
1252 | goto Away; | ||
1240 | } | 1253 | } |
1241 | 1254 | ||
1242 | INIT_LIST_HEAD(&pDevInfo->entry); | 1255 | INIT_LIST_HEAD(&pDevInfo->entry); |
@@ -1287,14 +1300,15 @@ my_device_changestate(CONTROLVM_MESSAGE *inmsg) | |||
1287 | busNo, devNo); | 1300 | busNo, devNo); |
1288 | POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, | 1301 | POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, |
1289 | POSTCODE_SEVERITY_ERR); | 1302 | POSTCODE_SEVERITY_ERR); |
1290 | RETINT(-CONTROLVM_RESP_ERROR_DEVICE_INVALID); | 1303 | rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; |
1304 | goto Away; | ||
1291 | } | 1305 | } |
1292 | if (pDevInfo->state.created == 0) { | 1306 | if (pDevInfo->state.created == 0) { |
1293 | LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (not created)", | 1307 | LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (not created)", |
1294 | busNo, devNo); | 1308 | busNo, devNo); |
1295 | POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, | 1309 | POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo, |
1296 | POSTCODE_SEVERITY_ERR); | 1310 | POSTCODE_SEVERITY_ERR); |
1297 | RETINT(-CONTROLVM_RESP_ERROR_DEVICE_INVALID); | 1311 | rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; |
1298 | } | 1312 | } |
1299 | Away: | 1313 | Away: |
1300 | if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) | 1314 | if ((rc >= CONTROLVM_RESP_SUCCESS) && pDevInfo) |
@@ -1317,12 +1331,13 @@ my_device_destroy(CONTROLVM_MESSAGE *inmsg) | |||
1317 | if (!pDevInfo) { | 1331 | if (!pDevInfo) { |
1318 | LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu invalid", | 1332 | LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu invalid", |
1319 | busNo, devNo); | 1333 | busNo, devNo); |
1320 | RETINT(-CONTROLVM_RESP_ERROR_DEVICE_INVALID); | 1334 | rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; |
1335 | goto Away; | ||
1321 | } | 1336 | } |
1322 | if (pDevInfo->state.created == 0) { | 1337 | if (pDevInfo->state.created == 0) { |
1323 | LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu already destroyed", | 1338 | LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu already destroyed", |
1324 | busNo, devNo); | 1339 | busNo, devNo); |
1325 | RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE); | 1340 | rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; |
1326 | } | 1341 | } |
1327 | 1342 | ||
1328 | Away: | 1343 | Away: |
@@ -1349,19 +1364,22 @@ initialize_controlvm_payload_info(HOSTADDRESS phys_addr, U64 offset, U32 bytes, | |||
1349 | if (info == NULL) { | 1364 | if (info == NULL) { |
1350 | LOGERR("HUH ? CONTROLVM_PAYLOAD_INIT Failed : Programmer check at %s:%d", | 1365 | LOGERR("HUH ? CONTROLVM_PAYLOAD_INIT Failed : Programmer check at %s:%d", |
1351 | __FILE__, __LINE__); | 1366 | __FILE__, __LINE__); |
1352 | RETINT(-CONTROLVM_RESP_ERROR_PAYLOAD_INVALID); | 1367 | rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; |
1368 | goto Away; | ||
1353 | } | 1369 | } |
1354 | memset(info, 0, sizeof(CONTROLVM_PAYLOAD_INFO)); | 1370 | memset(info, 0, sizeof(CONTROLVM_PAYLOAD_INFO)); |
1355 | if ((offset == 0) || (bytes == 0)) { | 1371 | if ((offset == 0) || (bytes == 0)) { |
1356 | LOGERR("CONTROLVM_PAYLOAD_INIT Failed: RequestPayloadOffset=%llu RequestPayloadBytes=%llu!", | 1372 | LOGERR("CONTROLVM_PAYLOAD_INIT Failed: RequestPayloadOffset=%llu RequestPayloadBytes=%llu!", |
1357 | (u64) offset, (u64) bytes); | 1373 | (u64) offset, (u64) bytes); |
1358 | RETINT(-CONTROLVM_RESP_ERROR_PAYLOAD_INVALID); | 1374 | rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID; |
1375 | goto Away; | ||
1359 | } | 1376 | } |
1360 | payload = ioremap_cache(phys_addr + offset, bytes); | 1377 | payload = ioremap_cache(phys_addr + offset, bytes); |
1361 | if (payload == NULL) { | 1378 | if (payload == NULL) { |
1362 | LOGERR("CONTROLVM_PAYLOAD_INIT Failed: ioremap_cache %llu for %llu bytes failed", | 1379 | LOGERR("CONTROLVM_PAYLOAD_INIT Failed: ioremap_cache %llu for %llu bytes failed", |
1363 | (u64) offset, (u64) bytes); | 1380 | (u64) offset, (u64) bytes); |
1364 | RETINT(-CONTROLVM_RESP_ERROR_IOREMAP_FAILED); | 1381 | rc = -CONTROLVM_RESP_ERROR_IOREMAP_FAILED; |
1382 | goto Away; | ||
1365 | } | 1383 | } |
1366 | 1384 | ||
1367 | info->offset = offset; | 1385 | info->offset = offset; |
@@ -2796,10 +2814,8 @@ visorchipset_init(void) | |||
2796 | } | 2814 | } |
2797 | LOGINF("visorchipset device created"); | 2815 | LOGINF("visorchipset device created"); |
2798 | POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC, POSTCODE_SEVERITY_INFO); | 2816 | POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC, POSTCODE_SEVERITY_INFO); |
2799 | RETINT(0); | 2817 | rc = 0; |
2800 | |||
2801 | Away: | 2818 | Away: |
2802 | |||
2803 | if (rc) { | 2819 | if (rc) { |
2804 | LOGERR("visorchipset_init failed"); | 2820 | LOGERR("visorchipset_init failed"); |
2805 | POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc, | 2821 | POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc, |
diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index c1375ed1c098..0ceede129e87 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c | |||
@@ -98,11 +98,10 @@ static int charqueue_dequeue_1(CHARQUEUE *charqueue) | |||
98 | 98 | ||
99 | int charqueue_dequeue(CHARQUEUE *charqueue) | 99 | int charqueue_dequeue(CHARQUEUE *charqueue) |
100 | { | 100 | { |
101 | int rc = -1; | 101 | int rc; |
102 | 102 | ||
103 | spin_lock(&charqueue->lock); | 103 | spin_lock(&charqueue->lock); |
104 | RETINT(charqueue_dequeue_1(charqueue)); | 104 | rc = charqueue_dequeue_1(charqueue); |
105 | Away: | ||
106 | spin_unlock(&charqueue->lock); | 105 | spin_unlock(&charqueue->lock); |
107 | return rc; | 106 | return rc; |
108 | } | 107 | } |
@@ -111,7 +110,7 @@ Away: | |||
111 | 110 | ||
112 | int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) | 111 | int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) |
113 | { | 112 | { |
114 | int rc = -1, counter = 0, c; | 113 | int rc, counter = 0, c; |
115 | 114 | ||
116 | spin_lock(&charqueue->lock); | 115 | spin_lock(&charqueue->lock); |
117 | for (;;) { | 116 | for (;;) { |
@@ -125,9 +124,7 @@ int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) | |||
125 | n--; | 124 | n--; |
126 | counter++; | 125 | counter++; |
127 | } | 126 | } |
128 | RETINT(counter); | 127 | rc = counter; |
129 | |||
130 | Away: | ||
131 | spin_unlock(&charqueue->lock); | 128 | spin_unlock(&charqueue->lock); |
132 | return rc; | 129 | return rc; |
133 | } | 130 | } |