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 <bgolaszew...@baylibre.com>
---
 src/hardware/baylibre-acme/protocol.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/hardware/baylibre-acme/protocol.c 
b/src/hardware/baylibre-acme/protocol.c
index d055255..f8fdb59 100644
--- a/src/hardware/baylibre-acme/protocol.c
+++ b/src/hardware/baylibre-acme/protocol.c
@@ -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;
 }
-- 
2.1.4


------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to