Commit 2131aecc authored by Bernard Blackham's avatar Bernard Blackham Committed by Kevin Hilman

I2C: DaVinci: Fix i2c GPIO expander deadlock

GPIO expander failure case did not unlock a mutex (e.g. when the I2C
bus could not be found). Fix that.
Signed-off-by: default avatarBernard Blackham <bernard@largestprime.net>
Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
parent 52b63105
...@@ -77,7 +77,7 @@ int davinci_i2c_expander_op(u16 client_addr, u35_expander_ops pin, u8 val) ...@@ -77,7 +77,7 @@ int davinci_i2c_expander_op(u16 client_addr, u35_expander_ops pin, u8 val)
err = davinci_i2c_expander_read(1, &data_to_u35, 0x3A); err = davinci_i2c_expander_read(1, &data_to_u35, 0x3A);
if (err < 0) if (err < 0)
return err; goto out;
if (client_addr == 0x3A) { if (client_addr == 0x3A) {
switch (pin) { switch (pin) {
...@@ -128,13 +128,14 @@ int davinci_i2c_expander_op(u16 client_addr, u35_expander_ops pin, u8 val) ...@@ -128,13 +128,14 @@ int davinci_i2c_expander_op(u16 client_addr, u35_expander_ops pin, u8 val)
break; break;
} }
} else { } else {
printk("Only IO Expander at address 0x3A is suuported\n"); printk("Only IO Expander at address 0x3A is supported\n");
mutex_unlock(&expander_lock); err = -EINVAL;
return -EINVAL; goto out;
} }
err = davinci_i2c_expander_write(1, &data_to_u35, 0x3A); err = davinci_i2c_expander_write(1, &data_to_u35, 0x3A);
out:
mutex_unlock(&expander_lock); mutex_unlock(&expander_lock);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment