diff options
author | 2006-06-17 23:00:47 +0000 | |
---|---|---|
committer | 2006-06-17 23:00:47 +0000 | |
commit | a923c44b4ca94b326a5982fc58c8d2744eeae794 (patch) | |
tree | 8b769aa3bc867d0d8739b961005a87b88c99eecf /sys/dev/i2c | |
parent | Fix error where soft irq mask was not initialized for IPL_HIGH, and cleanup. (diff) | |
download | wireguard-openbsd-a923c44b4ca94b326a5982fc58c8d2744eeae794.tar.xz wireguard-openbsd-a923c44b4ca94b326a5982fc58c8d2744eeae794.zip |
Better checks to avoid attaching when device is not present.
Diffstat (limited to 'sys/dev/i2c')
-rw-r--r-- | sys/dev/i2c/pca9532.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/i2c/pca9532.c b/sys/dev/i2c/pca9532.c index 406a80d2745..f26b2007569 100644 --- a/sys/dev/i2c/pca9532.c +++ b/sys/dev/i2c/pca9532.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pca9532.c,v 1.1 2006/06/17 04:43:01 drahn Exp $ */ +/* $OpenBSD: pca9532.c,v 1.2 2006/06/17 23:00:47 drahn Exp $ */ /* * Copyright (c) 2006 Dale Rahn <drahn@openbsd.org> * @@ -74,10 +74,14 @@ pcaled_match(struct device *parent, void *v, void *arg) if (iic_exec(ia->ia_tag, I2C_OP_READ_WITH_STOP, ia->ia_addr, &cmd, 1, &data, 1, I2C_F_POLL)) goto fail; + cmd = 9; + if (iic_exec(ia->ia_tag, I2C_OP_READ_WITH_STOP, ia->ia_addr, + &cmd, 1, &data, 1, I2C_F_POLL)) + goto fail; ok = 1; fail: iic_release_bus(ia->ia_tag, I2C_F_POLL); - return (1); + return (ok); } void |