提交 5cd6e675 编写于 作者: J Jean Delvare 提交者: Jean Delvare

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: NJean Delvare <khali@linux-fr.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
上级 f9dd0194
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册