Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c In cx24227_writereg() / cx24227_readreg(), retur...



details:   https://anonhg.NetBSD.org/src/rev/47f976e79d7a
branches:  trunk
changeset: 967833:47f976e79d7a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Dec 23 18:03:14 2019 +0000

description:
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.

diffstat:

 sys/dev/i2c/cx24227.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 24f46ace8e14 -r 47f976e79d7a sys/dev/i2c/cx24227.c
--- a/sys/dev/i2c/cx24227.c     Mon Dec 23 17:51:57 2019 +0000
+++ b/sys/dev/i2c/cx24227.c     Mon Dec 23 18:03:14 2019 +0000
@@ -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 @@
        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 @@
 
        *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);



Home | Main Index | Thread Index | Old Index