From khali@linux-fr.org Sun Sep 3 13:25:08 2006 Date: Sun, 3 Sep 2006 22:25:04 +0200 From: Jean Delvare To: Greg KH Cc: Linux I2C Subject: [PATCH 07/13] i2c: Warn on i2c client creation failure Message-Id: <20060903222504.b7eaae85.khali@linux-fr.org> Content-Disposition: inline; filename=i2c-warn-on-failed-client-attach.patch i2c: Warn on i2c client creation failure Warn when an i2c client creation fails. If we don't, the user will never know something wrong happened, as i2c client creation is typically called through an attach_adapter callback, those return value we currently ignore for technical reasons. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/i2c-core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- gregkh-2.6.orig/drivers/i2c/i2c-core.c +++ gregkh-2.6/drivers/i2c/i2c-core.c @@ -707,11 +707,16 @@ static int i2c_probe_address(struct i2c_ /* Finally call the custom detection function */ err = found_proc(adapter, addr, kind); - /* -ENODEV can be returned if there is a chip at the given address but it isn't supported by this chip driver. We catch it here as this isn't an error. */ - return (err == -ENODEV) ? 0 : err; + if (err == -ENODEV) + err = 0; + + if (err) + dev_warn(&adapter->dev, "Client creation failed at 0x%x (%d)\n", + addr, err); + return err; } int i2c_probe(struct i2c_adapter *adapter,