summaryrefslogtreecommitdiffstats
path: root/drivers/staging/xillybus/xillybus_core.c
diff options
context:
space:
mode:
authorEli Billauer2014-09-04 16:47:45 +0200
committerGreg Kroah-Hartman2014-09-08 22:58:19 +0200
commit9ac77ec61f943952019543c37848c0c9a97add15 (patch)
tree8e805bac85003516db900e0eab249044447a9eba /drivers/staging/xillybus/xillybus_core.c
parentstaging: xillybus: Removed unnecessary error message (diff)
downloadkernel-qcow2-linux-9ac77ec61f943952019543c37848c0c9a97add15.tar.gz
kernel-qcow2-linux-9ac77ec61f943952019543c37848c0c9a97add15.tar.xz
kernel-qcow2-linux-9ac77ec61f943952019543c37848c0c9a97add15.zip
staging: xillybus: Improved error handling
xilly_scan_idt() now returns an error status code, rather than being a void function and hint the status through an entry in a data structure. Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Eli Billauer <eli.billauer@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/xillybus/xillybus_core.c')
-rw-r--r--drivers/staging/xillybus/xillybus_core.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c
index 222457fe9bb8..fc14b143d413 100644
--- a/drivers/staging/xillybus/xillybus_core.c
+++ b/drivers/staging/xillybus/xillybus_core.c
@@ -568,8 +568,8 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
return 0;
}
-static void xilly_scan_idt(struct xilly_endpoint *endpoint,
- struct xilly_idt_handle *idt_handle)
+static int xilly_scan_idt(struct xilly_endpoint *endpoint,
+ struct xilly_idt_handle *idt_handle)
{
int count = 0;
unsigned char *idt = endpoint->channels[1]->wr_buffers[0]->addr;
@@ -593,23 +593,22 @@ static void xilly_scan_idt(struct xilly_endpoint *endpoint,
if (scan > end_of_idt) {
dev_err(endpoint->dev,
"IDT device name list overflow. Aborting.\n");
- idt_handle->chandesc = NULL;
- return;
+ return -ENODEV;
}
idt_handle->chandesc = scan;
len = endpoint->idtlen - (3 + ((int) (scan - idt)));
if (len & 0x03) {
- idt_handle->chandesc = NULL;
-
dev_err(endpoint->dev,
"Corrupt IDT device name list. Aborting.\n");
+ return -ENODEV;
}
idt_handle->entries = len >> 2;
-
endpoint->num_channels = count;
+
+ return 0;
}
static int xilly_obtain_idt(struct xilly_endpoint *endpoint)
@@ -2041,12 +2040,9 @@ int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint)
if (rc)
goto failed_idt;
- xilly_scan_idt(endpoint, &idt_handle);
-
- if (!idt_handle.chandesc) {
- rc = -ENODEV;
+ rc = xilly_scan_idt(endpoint, &idt_handle);
+ if (rc)
goto failed_idt;
- }
devres_close_group(dev, bootstrap_resources);