ASoC: Return proper error if i2c_add_driver fails
Subsystems (3)
PATCH 1/1 ASoC: Return proper error if i2c_add_driver fails
Signed-off-by Axel Lin <[email protected]>
--- sound/soc/codecs/wm8523.c | 4 ++-- sound/soc/codecs/wm8711.c | 4 ++-- sound/soc/codecs/wm8737.c | 4 ++-- sound/soc/codecs/wm8962.c | 4 ++-- sound/soc/codecs/wm8991.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
sound/soc/codecs/wm8523.c +2 -2
@@ -559,7 +559,7 @@ static struct i2c_driver wm8523_i2c_driver = {static int __init wm8523_modinit (void ) { -int ret; +int ret =0 ;#if defined(CONFIG_I2C ) || defined(CONFIG_I2C_MODULE ) ret =i2c_add_driver (&wm8523_i2c_driver);if (ret !=0 ) {
@@ -567,7 +567,7 @@ static int __init wm8523_modinit(void) ret); }#endif -return 0 ; +return ret; }module_init (wm8523_modinit);
sound/soc/codecs/wm8711.c +2 -2
@@ -494,7 +494,7 @@ static struct i2c_driver wm8711_i2c_driver = {static int __init wm8711_modinit (void ) { -int ret; +int ret =0 ;#if defined(CONFIG_I2C ) || defined(CONFIG_I2C_MODULE ) ret =i2c_add_driver (&wm8711_i2c_driver);if (ret !=0 ) {
@@ -509,7 +509,7 @@ static int __init wm8711_modinit(void) ret); }#endif -return 0 ; +return ret; }module_init (wm8711_modinit);
sound/soc/codecs/wm8737.c +2 -2
@@ -728,7 +728,7 @@ static struct spi_driver wm8737_spi_driver = {static int __init wm8737_modinit (void ) { -int ret; +int ret =0 ;#if defined(CONFIG_I2C ) || defined(CONFIG_I2C_MODULE ) ret =i2c_add_driver (&wm8737_i2c_driver);if (ret !=0 ) {
@@ -743,7 +743,7 @@ static int __init wm8737_modinit(void) ret); }#endif -return 0 ; +return ret; }module_init (wm8737_modinit);
sound/soc/codecs/wm8962.c +2 -2
@@ -4288,7 +4288,7 @@ static struct i2c_driver wm8962_i2c_driver = {static int __init wm8962_modinit (void ) { -int ret; +int ret =0 ;#if defined(CONFIG_I2C ) || defined(CONFIG_I2C_MODULE ) ret =i2c_add_driver (&wm8962_i2c_driver);if (ret !=0 ) {
@@ -4296,7 +4296,7 @@ static int __init wm8962_modinit(void) ret); }#endif -return 0 ; +return ret; }module_init (wm8962_modinit);
sound/soc/codecs/wm8991.c +2 -2
@@ -1402,13 +1402,13 @@ static struct i2c_driver wm8991_i2c_driver = {static int __init wm8991_modinit (void ) { -int ret; +int ret =0 ; ret =i2c_add_driver (&wm8991_i2c_driver);if (ret !=0 ) {printk (KERN_ERR "Failed to register WM8991 I2C driver: %d\n" , ret); } -return 0 ; +return ret; }module_init (wm8991_modinit);
Signature · 1 line
1.7.5.4
Review
Quoted 3 lines · Axel Lin
#endif
(quoted diff) +1
-1- return 0; + return ret;
No, if we've got multiple bus types we do ignore the error in case one of the buses failed (and if we were doing this then we'd need to clean
up the thing that successfully registered). If we've not got multiple
bus types then the ifdefs shouldn't be there and we should just have a trivial call to the registration function.