[i2c] [PATCH] i2c-sibyte: Fix an error path
Jean Delvare
khali at linux-fr.org
Wed Mar 7 19:56:23 CET 2007
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 at linux-fr.org>
Cc: Ralf Baechle <ralf at linux-mips.org>
---
drivers/i2c/busses/i2c-sibyte.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- linux-2.6.21-rc2.orig/drivers/i2c/busses/i2c-sibyte.c 2007-02-04 19:44:54.000000000 +0100
+++ linux-2.6.21-rc2/drivers/i2c/busses/i2c-sibyte.c 2007-03-07 19:39:10.000000000 +0100
@@ -200,11 +200,13 @@ static struct i2c_adapter sibyte_board_a
static int __init i2c_sibyte_init(void)
{
- printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n");
+ printk(KERN_INFO "i2c-sibyte: i2c SMBus adapter module for SiByte board\n");
if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0)
return -ENODEV;
- if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0)
+ if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0) {
+ i2c_del_adapter(&sibyte_board_adapter[0]);
return -ENODEV;
+ }
return 0;
}
--
Jean Delvare
More information about the i2c
mailing list