summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/gpio.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-03-19 16:55:23 +0100
committerGreg Kroah-Hartman <greg@kroah.com>2015-03-19 17:30:38 +0100
commit792c17e64383340a75579cdfc6b9b6d2b1647b43 (patch)
tree032894cb00e36751682459b7fa26577c9ab90f79 /drivers/staging/greybus/gpio.c
parent7bfa0781406f9df6cb20ce5134faa19d34cb4e18 (diff)
greybus: gpio: add error messages to callbacks not propagating errors
Add error messages on failures to deactivate, set and get operation handlers as any errors would not be detected by the upper layers (either because the callbacks are declared void or expected to return a boolean value). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/gpio.c')
-rw-r--r--drivers/staging/greybus/gpio.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index 7e51840cd262..2bac28ec7f85 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -184,8 +184,13 @@ static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc,
request.which = which;
ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_DEACTIVATE,
&request, sizeof(request), NULL, 0);
- if (!ret)
- ggc->lines[which].active = false;
+ if (ret) {
+ dev_err(ggc->chip.dev, "failed to deactivate gpio %u\n",
+ which);
+ return;
+ }
+
+ ggc->lines[which].active = false;
}
static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc,
@@ -254,8 +259,11 @@ static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc,
ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_GET_VALUE,
&request, sizeof(request),
&response, sizeof(response));
- if (ret)
+ if (ret) {
+ dev_err(ggc->chip.dev, "failed to get value of gpio %u\n",
+ which);
return ret;
+ }
value = response.value;
if (value && value != 1) {
@@ -283,8 +291,13 @@ static void gb_gpio_set_value_operation(struct gb_gpio_controller *ggc,
request.value = value_high ? 1 : 0;
ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_SET_VALUE,
&request, sizeof(request), NULL, 0);
- if (!ret)
- ggc->lines[which].value = request.value;
+ if (ret) {
+ dev_err(ggc->chip.dev, "failed to set value of gpio %u\n",
+ which);
+ return;
+ }
+
+ ggc->lines[which].value = request.value;
}
static int gb_gpio_set_debounce_operation(struct gb_gpio_controller *ggc,