Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Carefully access to the I2C bus in the match fun...



details:   https://anonhg.NetBSD.org/src/rev/51557fe1488c
branches:  trunk
changeset: 1026763:51557fe1488c
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Dec 06 04:25:36 2021 +0000

description:
Carefully access to the I2C bus in the match function.

diffstat:

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

diffs (28 lines):

diff -r b7ec7dd9852f -r 51557fe1488c sys/dev/i2c/spdmem_i2c.c
--- a/sys/dev/i2c/spdmem_i2c.c  Sun Dec 05 22:59:32 2021 +0000
+++ b/sys/dev/i2c/spdmem_i2c.c  Mon Dec 06 04:25:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem_i2c.c,v 1.23 2021/11/30 05:02:29 msaitoh Exp $ */
+/* $NetBSD: spdmem_i2c.c,v 1.24 2021/12/06 04:25:36 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.23 2021/11/30 05:02:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.24 2021/12/06 04:25:36 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -117,6 +117,9 @@
         */
        rv = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, &reg, 1,
            &byte0, 1, 0);
+       if (rv != 0)
+               goto error;
+
        reg = 2;
        rv |= iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, &reg, 1,
            &byte2, 1, 0);



Home | Main Index | Thread Index | Old Index