Module Name:    src
Committed By:   jmcneill
Date:           Mon Oct  3 23:53:04 UTC 2011

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

Log Message:
iic_ioctl_exec: if the i2c controller's "exec" function uses -1 instead of
an error code to report failure, convert it to EIO.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/i2c/i2c.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/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.35 src/sys/dev/i2c/i2c.c:1.36
--- src/sys/dev/i2c/i2c.c:1.35	Mon Oct  3 22:27:23 2011
+++ src/sys/dev/i2c/i2c.c	Mon Oct  3 23:53:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.35 2011/10/03 22:27:23 jmcneill Exp $	*/
+/*	$NetBSD: i2c.c,v 1.36 2011/10/03 23:53:04 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.35 2011/10/03 22:27:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.36 2011/10/03 23:53:04 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -508,6 +508,12 @@ iic_ioctl_exec(struct iic_softc *sc, i2c
 	    buf, iie->iie_buflen, 0);
 	iic_release_bus(ic, 0);
 
+	/*
+	 * Some drivers return error codes on failure, and others return -1.
+	 */
+	if (error < 0)
+		error = EIO;
+
 	if (cmd)
 		kmem_free(cmd, iie->iie_cmdlen);
 

Reply via email to