Skip to content

Commit

Permalink
i2c-sibyte: Fix an error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Jan 14, 2008
1 parent f9dd019 commit 5cd6e67
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/i2c/busses/i2c-sibyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,14 @@ static struct i2c_adapter sibyte_board_adapter[2] = {

static int __init i2c_sibyte_init(void)
{
printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n");
pr_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;
}

Expand Down

0 comments on commit 5cd6e67

Please sign in to comment.