diff options
author | Ken Cox <jkc@redhat.com> | 2014-03-19 18:06:24 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-19 20:56:31 (GMT) |
commit | 5e54c97dab0298cf5479bc1f2d3f42ef5605ce6e (patch) | |
tree | 2cad1122b5e503999c85dfb3ac98c5958658201d /drivers/staging | |
parent | 097f4c19e838b5e8a5674b1ab9def7e20bc88e7a (diff) | |
download | linux-5e54c97dab0298cf5479bc1f2d3f42ef5605ce6e.tar.xz |
Staging: unisys: Remove FAIL macro
The FAIL macro ultimately includes 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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/unisys/include/timskmod.h | 12 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 97 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/file.c | 7 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/procobjecttree.c | 52 |
4 files changed, 103 insertions, 65 deletions
diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h index 1101ecd..3f8e6a2 100644 --- a/drivers/staging/unisys/include/timskmod.h +++ b/drivers/staging/unisys/include/timskmod.h @@ -126,18 +126,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */ * @param x the value to return */ #define RETINT(x) do { rc = (x); RETTRACE(x); goto Away; } while (0) -/** Given a typedef/struct/union and a member field name, - * return the number of bytes occupied by that field. - * @param TYPE the typedef name, or "struct xx" or "union xx" - * @param MEMBER the name of the member field whose size is to be determined - * @return the size of the field in bytes - */ -#define FAIL(msg, status) do { \ - ERRDRV("'%s'" \ - ": error (status=%d)\n", \ - msg, status); \ - RETINT(status); \ - } while (0) /** Try to evaulate the provided expression, and do a RETINT(x) iff * the expression evaluates to < 0. * @param x the expression to try diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 99889fd..8a200af 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -57,8 +57,11 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, void *rc = NULL; p = kmalloc(sizeof(VISORCHANNEL), GFP_KERNEL|__GFP_NORETRY); - if (p == NULL) - FAIL("allocation failed", 0); + if (p == NULL) { + ERRDRV("allocation failed: (status=0)\n"); + rc = NULL; + goto Away; + } p->memregion = NULL; p->needs_lock = needs_lock; spin_lock_init(&p->insert_lock); @@ -73,19 +76,28 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, visor_memregion_create_overlapped(parent->memregion, off, sizeof(CHANNEL_HEADER)); - if (p->memregion == NULL) - FAIL("visor_memregion_create failed", 0); + if (p->memregion == NULL) { + ERRDRV("visor_memregion_create failed failed: (status=0)\n"); + rc = NULL; + goto Away; + } if (visor_memregion_read(p->memregion, 0, &p->chan_hdr, - sizeof(CHANNEL_HEADER)) < 0) - FAIL("visor_memregion_read failed", 0); + sizeof(CHANNEL_HEADER)) < 0) { + ERRDRV("visor_memregion_read failed: (status=0)\n"); + rc = NULL; + goto Away; + } if (channelBytes == 0) /* we had better be a CLIENT of this channel */ channelBytes = (ulong) p->chan_hdr.Size; if (STRUCTSEQUAL(guid, Guid0)) /* we had better be a CLIENT of this channel */ guid = p->chan_hdr.Type; - if (visor_memregion_resize(p->memregion, channelBytes) < 0) - FAIL("visor_memregion_resize failed", 0); + if (visor_memregion_resize(p->memregion, channelBytes) < 0) { + ERRDRV("visor_memregion_resize failed: (status=0)\n"); + rc = NULL; + goto Away; + } p->size = channelBytes; p->guid = guid; @@ -300,8 +312,10 @@ sig_read_header(VISORCHANNEL *channel, U32 queue, { BOOL rc = FALSE; - if (channel->chan_hdr.oChannelSpace < sizeof(CHANNEL_HEADER)) - FAIL("oChannelSpace too small", FALSE); + if (channel->chan_hdr.oChannelSpace < sizeof(CHANNEL_HEADER)) { + ERRDRV("oChannelSpace too small: (status=%d)\n", rc); + goto Away; + } /* Read the appropriate SIGNAL_QUEUE_HEADER into local memory. */ @@ -310,7 +324,8 @@ sig_read_header(VISORCHANNEL *channel, U32 queue, sig_hdr, sizeof(SIGNAL_QUEUE_HEADER)) < 0) { ERRDRV("queue=%d SIG_QUEUE_OFFSET=%d", queue, (int)SIG_QUEUE_OFFSET(&channel->chan_hdr, queue)); - FAIL("visor_memregion_read of signal queue failed", FALSE); + ERRDRV("visor_memregion_read of signal queue failed: (status=%d)\n", rc); + goto Away; } rc = TRUE; Away: @@ -327,14 +342,16 @@ sig_do_data(VISORCHANNEL *channel, U32 queue, if (is_write) { if (visor_memregion_write(channel->memregion, signal_data_offset, - data, sig_hdr->SignalSize) < 0) - FAIL("visor_memregion_write of signal data failed", - FALSE); + data, sig_hdr->SignalSize) < 0) { + ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n", rc); + goto Away; + } } else { if (visor_memregion_read(channel->memregion, signal_data_offset, - data, sig_hdr->SignalSize) < 0) - FAIL("visor_memregion_read of signal data failed", - FALSE); + data, sig_hdr->SignalSize) < 0) { + ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n", rc); + goto Away; + } } rc = TRUE; Away: @@ -395,19 +412,25 @@ visorchannel_signalremove(VISORCHANNEL *channel, U32 queue, void *msg) goto Away; } sig_hdr.Tail = (sig_hdr.Tail + 1) % sig_hdr.MaxSignalSlots; - if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.Tail, msg)) - FAIL("sig_read_data failed", FALSE); + if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.Tail, msg)) { + ERRDRV("sig_read_data failed: (status=%d)\n", rc); + goto Away; + } sig_hdr.NumSignalsReceived++; /* For each data field in SIGNAL_QUEUE_HEADER that was modified, * update host memory. */ MEMORYBARRIER; - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Tail)) - FAIL("visor_memregion_write of Tail failed", FALSE); - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsReceived)) - FAIL("visor_memregion_write of NumSignalsReceived failed", - FALSE); + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Tail)) { + ERRDRV("visor_memregion_write of Tail failed: (status=%d)\n", + rc); + goto Away; + } + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsReceived)) { + ERRDRV("visor_memregion_write of NumSignalsReceived failed: (status=%d)\n", rc); + goto Away; + } rc = TRUE; Away: if (channel->needs_lock) @@ -434,25 +457,33 @@ visorchannel_signalinsert(VISORCHANNEL *channel, U32 queue, void *msg) sig_hdr.Head = ((sig_hdr.Head + 1) % sig_hdr.MaxSignalSlots); if (sig_hdr.Head == sig_hdr.Tail) { sig_hdr.NumOverflows++; - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumOverflows)) - FAIL("visor_memregion_write of NumOverflows failed", - FALSE); + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumOverflows)) { + ERRDRV("visor_memregion_write of NumOverflows failed: (status=%d)\n", rc); + goto Away; + } rc = FALSE; goto Away; } - if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.Head, msg)) - FAIL("sig_write_data failed", FALSE); + if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.Head, msg)) { + ERRDRV("sig_write_data failed: (status=%d)\n", rc); + goto Away; + } sig_hdr.NumSignalsSent++; /* For each data field in SIGNAL_QUEUE_HEADER that was modified, * update host memory. */ MEMORYBARRIER; - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Head)) - FAIL("visor_memregion_write of Head failed", FALSE); - if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsSent)) - FAIL("visor_memregion_write of NumSignalsSent failed", FALSE); + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Head)) { + ERRDRV("visor_memregion_write of Head failed: (status=%d)\n", + rc); + goto Away; + } + if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsSent)) { + ERRDRV("visor_memregion_write of NumSignalsSent failed: (status=%d)\n", rc); + goto Away; + } rc = TRUE; Away: if (channel->needs_lock) diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 7e8bc98..839a943a 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -84,8 +84,11 @@ visorchipset_file_init(dev_t majorDev, VISORCHANNEL **pControlVm_channel) Registered = TRUE; INFODRV("Static major number %d registered\n", MAJOR(MajorDev)); } - if (cdev_add(&Cdev, MKDEV(MAJOR(MajorDev), 0), 1) < 0) - FAIL("failed to create char device", -1); + if (cdev_add(&Cdev, MKDEV(MAJOR(MajorDev), 0), 1) < 0) { + ERRDRV("failed to create char device: (status=-1)\n"); + rc = -1; + goto Away; + } INFODRV("Registered char device for %s (major=%d)", MYDRVNAME, MAJOR(MajorDev)); RETINT(0); diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index 6a082b9..67a19e1 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -136,13 +136,19 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, MYPROCTYPE *rc = NULL, *type = NULL; struct proc_dir_entry *parent = NULL; - if (procDirRoot == NULL) - FAIL("procDirRoot cannot be NULL!", 0); - if (name == NULL || name[0] == NULL) - FAIL("name must contain at least 1 node name!", 0); + if (procDirRoot == NULL) { + ERRDRV("procDirRoot cannot be NULL!\n"); + goto Away; + } + if (name == NULL || name[0] == NULL) { + ERRDRV("name must contain at least 1 node name!\n"); + goto Away; + } type = kzalloc(sizeof(MYPROCTYPE), GFP_KERNEL | __GFP_NORETRY); - if (type == NULL) - FAIL("out of memory", 0); + if (type == NULL) { + ERRDRV("out of memory\n"); + goto Away; + } type->name = name; type->propertyNames = propertyNames; type->nProperties = 0; @@ -157,8 +163,10 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot, type->procDirs = kzalloc((type->nNames + 1) * sizeof(struct proc_dir_entry *), GFP_KERNEL | __GFP_NORETRY); - if (type->procDirs == NULL) - FAIL("out of memory", 0); + if (type->procDirs == NULL) { + ERRDRV("out of memory\n"); + goto Away; + } parent = procDirRoot; for (i = 0; i < type->nNames; i++) { type->procDirs[i] = createProcDir(type->name[i], parent); @@ -215,11 +223,15 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, MYPROCOBJECT *obj = NULL, *rc = NULL; int i = 0; - if (type == NULL) - FAIL("type cannot be NULL", 0); + if (type == NULL) { + ERRDRV("type cannot be NULL\n"); + goto Away; + } obj = kzalloc(sizeof(MYPROCOBJECT), GFP_KERNEL | __GFP_NORETRY); - if (obj == NULL) - FAIL("out of memory", 0); + if (obj == NULL) { + ERRDRV("out of memory\n"); + goto Away; + } obj->type = type; obj->context = context; if (name == NULL) { @@ -230,25 +242,29 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, obj->name = kmalloc(obj->namesize, GFP_KERNEL | __GFP_NORETRY); if (obj->name == NULL) { obj->namesize = 0; - FAIL("out of memory", 0); + ERRDRV("out of memory\n"); + goto Away; } strcpy(obj->name, name); obj->procDir = createProcDir(obj->name, type->procDir); if (obj->procDir == NULL) { - rc = NULL; goto Away; } } obj->procDirPropertyContexts = kzalloc((type->nProperties + 1) * sizeof(PROCDIRENTRYCONTEXT), GFP_KERNEL | __GFP_NORETRY); - if (obj->procDirPropertyContexts == NULL) - FAIL("out of memory", 0); + if (obj->procDirPropertyContexts == NULL) { + ERRDRV("out of memory\n"); + goto Away; + } obj->procDirProperties = kzalloc((type->nProperties + 1) * sizeof(struct proc_dir_entry *), GFP_KERNEL | __GFP_NORETRY); - if (obj->procDirProperties == NULL) - FAIL("out of memory", 0); + if (obj->procDirProperties == NULL) { + ERRDRV("out of memory\n"); + goto Away; + } for (i = 0; i < type->nProperties; i++) { obj->procDirPropertyContexts[i].procObject = obj; obj->procDirPropertyContexts[i].propertyIndex = i; |