diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2006-06-17 23:00:48 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2006-06-17 23:00:48 +0000 |
commit | d9b9ad221370d2295de6237bc1fd4912e4e3ee1e (patch) | |
tree | debd18162dcabc7cbf38b2a1c0c4ca9ecd12e30c /sys | |
parent | 391666dfb719582ab5ba9a9cf078ae610ad32129 (diff) |
Better checks to avoid attaching when device is not present.
Diffstat (limited to 'sys')
-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 |