staging: nvec: add error checking to nvec_event

Message ID 20180301172613.wp5j6wytp2docnpf@debian
State New
Headers show
Series
  • staging: nvec: add error checking to nvec_event
Related show

Commit Message

Thomas Avery March 1, 2018, 5:37 p.m.
This patch adds error checking to the nvec_power_poll function, which
allows for easier debugging if the driver has issues. 

Signed-off-by: Thomas Avery <tavery321@gmail.com>
---
 drivers/staging/nvec/nvec_power.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c
index 0e861c4bfcbf..c82679ae0563 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -347,6 +347,7 @@  static int const bat_iter[] = {
 
 static void nvec_power_poll(struct work_struct *work)
 {
+	int err;
 	char buf[] = { NVEC_SYS, GET_SYSTEM_STATUS };
 	struct nvec_power *power = container_of(work, struct nvec_power,
 						poller.work);
@@ -355,7 +356,10 @@  static void nvec_power_poll(struct work_struct *work)
 		counter = 0;
 
 	/* AC status via sys req */
-	nvec_write_async(power->nvec, buf, 2);
+	err = nvec_write_async(power->nvec, buf, 2);
+	if (err != 0)
+		return err;
+
 	msleep(100);
 
 	/*