aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/algos
diff options
context:
space:
mode:
authorMark M. Hoffman <mhoffman@lightlink.com>2006-07-01 11:16:06 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-07-12 18:43:07 -0400
commitb39ad0cf7c19fc14e8f823b1b36245f7a3711655 (patch)
treef30e4dcfb21bc6aae1dc8300cef28b912339d72c /drivers/i2c/algos
parent5d925fecac26651e6b0e19cf4ca16933aa640f99 (diff)
[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 <mhoffman@lightlink.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/algos')
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c3
-rw-r--r--drivers/i2c/algos/i2c-algo-ite.c4
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c6
-rw-r--r--drivers/i2c/algos/i2c-algo-pcf.c8
-rw-r--r--drivers/i2c/algos/i2c-algo-sibyte.c4
5 files changed, 11 insertions, 14 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index df05df1a0ef6..3d6fc82c2cfc 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -544,8 +544,7 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
544 adap->timeout = 100; /* default values, should */ 544 adap->timeout = 100; /* default values, should */
545 adap->retries = 3; /* be replaced by defines */ 545 adap->retries = 3; /* be replaced by defines */
546 546
547 i2c_add_adapter(adap); 547 return i2c_add_adapter(adap);
548 return 0;
549} 548}
550 549
551 550
diff --git a/drivers/i2c/algos/i2c-algo-ite.c b/drivers/i2c/algos/i2c-algo-ite.c
index 2db7bfc85225..70d8eefb5efc 100644
--- a/drivers/i2c/algos/i2c-algo-ite.c
+++ b/drivers/i2c/algos/i2c-algo-ite.c
@@ -742,10 +742,8 @@ int i2c_iic_add_bus(struct i2c_adapter *adap)
742 adap->retries = 3; /* be replaced by defines */ 742 adap->retries = 3; /* be replaced by defines */
743 adap->flags = 0; 743 adap->flags = 0;
744 744
745 i2c_add_adapter(adap);
746 iic_init(iic_adap); 745 iic_init(iic_adap);
747 746 return i2c_add_adapter(adap);
748 return 0;
749} 747}
750 748
751 749
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index 82946acab4c7..b88a6fcf7bd0 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -374,10 +374,10 @@ int i2c_pca_add_bus(struct i2c_adapter *adap)
374 adap->timeout = 100; /* default values, should */ 374 adap->timeout = 100; /* default values, should */
375 adap->retries = 3; /* be replaced by defines */ 375 adap->retries = 3; /* be replaced by defines */
376 376
377 rval = pca_init(pca_adap); 377 if ((rval = pca_init(pca_adap)))
378 return rval;
378 379
379 if (!rval) 380 rval = i2c_add_adapter(adap);
380 i2c_add_adapter(adap);
381 381
382 return rval; 382 return rval;
383} 383}
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
index 6e498df1f717..5b24930adb5a 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)
479 adap->timeout = 100; /* default values, should */ 479 adap->timeout = 100; /* default values, should */
480 adap->retries = 3; /* be replaced by defines */ 480 adap->retries = 3; /* be replaced by defines */
481 481
482 rval = pcf_init_8584(pcf_adap); 482 if ((rval = pcf_init_8584(pcf_adap)))
483 if (!rval) 483 return rval;
484 i2c_add_adapter(adap); 484
485 rval = i2c_add_adapter(adap);
486
485 return rval; 487 return rval;
486} 488}
487 489
diff --git a/drivers/i2c/algos/i2c-algo-sibyte.c b/drivers/i2c/algos/i2c-algo-sibyte.c
index 3df3f09995c2..32d41c6fac0f 100644
--- a/drivers/i2c/algos/i2c-algo-sibyte.c
+++ b/drivers/i2c/algos/i2c-algo-sibyte.c
@@ -173,9 +173,7 @@ int i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed)
173 printk("\n"); 173 printk("\n");
174 } 174 }
175 175
176 i2c_add_adapter(i2c_adap); 176 return i2c_add_adapter(i2c_adap);
177
178 return 0;
179} 177}
180 178
181 179