diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-14 15:53:31 -0500 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-01-14 15:53:31 -0500 |
commit | 5cd6e675f862568ad73c061665ee5080cfd952c5 (patch) | |
tree | 2a1d65b3a80ffaa21cd9e6835c8d35fb44c91865 /drivers/i2c | |
parent | f9dd0194ff23d612e463be764d73da7825da4aa1 (diff) |
i2c-sibyte: Fix an error path
If the registration of the second I2C channel fails, we really want to
unregister the first one before we return with an error.
While we're here, fix the printk right above so that it displays the
real driver name.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-sibyte.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c index 0ca599d3b402..503a134ec803 100644 --- a/drivers/i2c/busses/i2c-sibyte.c +++ b/drivers/i2c/busses/i2c-sibyte.c | |||
@@ -200,11 +200,14 @@ static struct i2c_adapter sibyte_board_adapter[2] = { | |||
200 | 200 | ||
201 | static int __init i2c_sibyte_init(void) | 201 | static int __init i2c_sibyte_init(void) |
202 | { | 202 | { |
203 | printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n"); | 203 | pr_info("i2c-sibyte: i2c SMBus adapter module for SiByte board\n"); |
204 | if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0) | 204 | if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0) |
205 | return -ENODEV; | 205 | return -ENODEV; |
206 | if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0) | 206 | if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], |
207 | K_SMB_FREQ_400KHZ) < 0) { | ||
208 | i2c_del_adapter(&sibyte_board_adapter[0]); | ||
207 | return -ENODEV; | 209 | return -ENODEV; |
210 | } | ||
208 | return 0; | 211 | return 0; |
209 | } | 212 | } |
210 | 213 | ||