Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ken Cox and committed by
Greg Kroah-Hartman
22ad57ba 5e54c97d

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