summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/es2.c
diff options
context:
space:
mode:
authorJohan Hovold2016-08-03 14:09:32 +0200
committerGreg Kroah-Hartman2016-08-03 15:42:38 +0200
commit4ae2d962637e4a002d1f0884dceec800c79b3ea4 (patch)
treea193375566df24554a44c4964a1dc1c5d89a7a35 /drivers/staging/greybus/es2.c
parentgreybus: es2: clean up ARPC symbol names (diff)
downloadkernel-qcow2-linux-4ae2d962637e4a002d1f0884dceec800c79b3ea4.tar.gz
kernel-qcow2-linux-4ae2d962637e4a002d1f0884dceec800c79b3ea4.tar.xz
kernel-qcow2-linux-4ae2d962637e4a002d1f0884dceec800c79b3ea4.zip
greybus: es2: always set result value
Make sure to always set the result value for ARPC instead of forcing every caller to do it in order to avoid compiler warnings. The ARPC result should still be ignored unless arpc_sync returns -EREMOTEIO. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/es2.c')
-rw-r--r--drivers/staging/greybus/es2.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index 0850b591500f..c31124d7defc 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -611,7 +611,7 @@ static int cport_reset(struct gb_host_device *hd, u16 cport_id)
struct usb_device *udev = es2->usb_dev;
struct arpc_cport_reset_req req;
int retval;
- int result = 0;
+ int result;
switch (cport_id) {
case GB_SVC_CPORT_ID:
@@ -1184,6 +1184,8 @@ static int arpc_sync(struct es2_ap_dev *es2, u8 type, void *payload,
unsigned long flags;
int retval;
+ *result = 0;
+
rpc = arpc_alloc(payload, size, type);
if (!rpc)
return -ENOMEM;
@@ -1205,11 +1207,12 @@ static int arpc_sync(struct es2_ap_dev *es2, u8 type, void *payload,
goto out_arpc_del;
}
- *result = rpc->resp->result;
- if (*result)
+ if (rpc->resp->result) {
retval = -EREMOTEIO;
- else
+ *result = rpc->resp->result;
+ } else {
retval = 0;
+ }
out_arpc_del:
spin_lock_irqsave(&es2->arpc_lock, flags);