]> sigrok.org Git - libsigrok.git/commitdiff
baylibre-acme: Add a missing return value check.
authorBartosz Golaszewski <redacted>
Mon, 13 Apr 2015 09:44:14 +0000 (11:44 +0200)
committerUwe Hermann <redacted>
Fri, 17 Apr 2015 14:42:36 +0000 (16:42 +0200)
Check the return value of sr_gpio_setval_export() in bl_acme_set_power_off()
and return an appropriate error if the call fails.

Signed-off-by: Bartosz Golaszewski <redacted>
src/hardware/baylibre-acme/protocol.c

index d0552553feffbebdb298cba9c1c848e0d87de1e8..f8fdb595435a21a49dc18fa6dcb03fcc9e16b331 100644 (file)
@@ -424,6 +424,11 @@ SR_PRIV int bl_acme_set_power_off(const struct sr_channel_group *cg,
        }
 
        val = sr_gpio_setval_export(pws_gpios[cgp->index], off ? 0 : 1);
+       if (val < 0) {
+               sr_err("Error setting power-off state: gpio: %d",
+                      pws_gpios[cgp->index]);
+               return SR_ERR_IO;
+       }
 
        return SR_OK;
 }