Module Name: src
Committed By: thorpej
Date: Sun Apr 19 17:08:14 UTC 2020
Modified Files:
src/sys/dev/i2c: i2c_exec.c
Log Message:
In iic_acquire_bus(), unlock the bus lock if the back-end returns an
error from its acquire-bus function.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/i2c/i2c_exec.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_exec.c
diff -u src/sys/dev/i2c/i2c_exec.c:1.15 src/sys/dev/i2c/i2c_exec.c:1.16
--- src/sys/dev/i2c/i2c_exec.c:1.15 Thu Jan 2 16:18:37 2020
+++ src/sys/dev/i2c/i2c_exec.c Sun Apr 19 17:08:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c_exec.c,v 1.15 2020/01/02 16:18:37 thorpej Exp $ */
+/* $NetBSD: i2c_exec.c,v 1.16 2020/04/19 17:08:14 thorpej Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.15 2020/01/02 16:18:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.16 2020/04/19 17:08:14 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -141,6 +141,10 @@ iic_acquire_bus(i2c_tag_t tag, int flags
error = (*tag->ic_acquire_bus)(tag->ic_cookie, flags);
}
+ if (__predict_false(error)) {
+ mutex_exit(&tag->ic_bus_lock);
+ }
+
return error;
}