Source-Changes-HG archive

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

[src/thorpej-i2c-spi-conf]: src/sys/dev/i2c Check for errors from iic_acquire...



details:   https://anonhg.NetBSD.org/src/rev/142620132525
branches:  thorpej-i2c-spi-conf
changeset: 378785:142620132525
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun May 16 15:40:20 2021 +0000

description:
Check for errors from iic_acquire_bus().

diffstat:

 sys/dev/i2c/spdmem_i2c.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r b98a650c1860 -r 142620132525 sys/dev/i2c/spdmem_i2c.c
--- a/sys/dev/i2c/spdmem_i2c.c  Sun May 16 15:27:12 2021 +0000
+++ b/sys/dev/i2c/spdmem_i2c.c  Sun May 16 15:40:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem_i2c.c,v 1.21.4.2 2021/05/16 15:27:12 thorpej Exp $ */
+/* $NetBSD: spdmem_i2c.c,v 1.21.4.3 2021/05/16 15:40:20 thorpej Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.2 2021/05/16 15:27:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.3 2021/05/16 15:40:20 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -107,7 +107,9 @@ spdmem_reset_page(struct spdmem_i2c_soft
 
        reg = 0;
 
-       iic_acquire_bus(sc->sc_tag, 0);
+       if ((rv = iic_acquire_bus(sc->sc_tag, 0)) != 0) {
+               return rv;
+       }
 
        /*
         * Try to read byte 0 and 2. If it failed, it's not spdmem or a device
@@ -306,7 +308,8 @@ spdmem_i2c_read(struct spdmem_softc *sof
 
        reg = addr & 0xff;
 
-       iic_acquire_bus(sc->sc_tag, 0);
+       if ((rv = iic_acquire_bus(sc->sc_tag, 0)) != 0)
+               return rv;
 
        if (addr & 0x100) {
                rv = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_page1,



Home | Main Index | Thread Index | Old Index