From b39ad0cf7c19fc14e8f823b1b36245f7a3711655 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sat, 1 Jul 2006 17:16:06 +0200 Subject: [PATCH] i2c: Handle i2c_add_adapter failure in i2c algorithm drivers Content-Disposition: inline; filename=i2c-algo-error-handling-fix.patch It is possible for i2c_add_adapter() to fail. Several I2C algorithm drivers ignore that fact. This (compile-tested only) patch fixes them. Signed-off-by: Mark M. Hoffman Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/algos/i2c-algo-pcf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/i2c/algos/i2c-algo-pcf.c') diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c index 6e498df1f71..5b24930adb5 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.c +++ b/drivers/i2c/algos/i2c-algo-pcf.c @@ -479,9 +479,11 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap) adap->timeout = 100; /* default values, should */ adap->retries = 3; /* be replaced by defines */ - rval = pcf_init_8584(pcf_adap); - if (!rval) - i2c_add_adapter(adap); + if ((rval = pcf_init_8584(pcf_adap))) + return rval; + + rval = i2c_add_adapter(adap); + return rval; } -- cgit v1.2.3-18-g5258