Module Name:    src
Committed By:   thorpej
Date:           Mon Dec 23 18:03:14 UTC 2019

Modified Files:
        src/sys/dev/i2c: cx24227.c

Log Message:
In cx24227_writereg() / cx24227_readreg(), return the error
from iic_acquire_bus(), not some bogus return value that can
potentially be confused for a real error code.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/cx24227.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/i2c/cx24227.c
diff -u src/sys/dev/i2c/cx24227.c:1.8 src/sys/dev/i2c/cx24227.c:1.9
--- src/sys/dev/i2c/cx24227.c:1.8	Thu Jun  1 02:45:10 2017
+++ src/sys/dev/i2c/cx24227.c	Mon Dec 23 18:03:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cx24227.c,v 1.8 2017/06/01 02:45:10 chs Exp $ */
+/* $NetBSD: cx24227.c,v 1.9 2019/12/23 18:03:14 thorpej Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.8 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.9 2019/12/23 18:03:14 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -108,8 +108,8 @@ cx24227_writereg(struct cx24227 *sc, uin
 	int error;
 	uint8_t r[3];
 
-	if (iic_acquire_bus(sc->tag, I2C_F_POLL) != 0)
-		return false;
+	if ((error = iic_acquire_bus(sc->tag, I2C_F_POLL) != 0))
+		return error;
 
 	r[0] = reg;
 	r[1] = (data >> 8) & 0xff;
@@ -130,8 +130,8 @@ cx24227_readreg(struct cx24227 *sc, uint
 
 	*data = 0x0000;
 
-	if (iic_acquire_bus(sc->tag, I2C_F_POLL) != 0)
-		return -1;
+	if ((error = iic_acquire_bus(sc->tag, I2C_F_POLL) != 0))
+		return error;
 
 	error = iic_exec(sc->tag, I2C_OP_READ_WITH_STOP, sc->addr,
 			 &reg, 1, r, 2, I2C_F_POLL);

Reply via email to