Skip to content

Commit

Permalink
Fixed a bug where pthread_init and pthread_destroy were called on int…
Browse files Browse the repository at this point in the history
…s instead of pthread_mutex_t
  • Loading branch information
sunipkm committed Apr 5, 2021
1 parent ee75f20 commit b641381
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions i2cbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int i2cbus_open(i2cbus *dev, int id, int addr)
{
for (int i = 0; i < __I2CBUS_MAX_NUM; i++)
{
int ret = pthread_mutex_init(&(__i2cbus_lock_ctx[i]), NULL);
int ret = pthread_mutex_init(&(__i2cbus_locks[i]), NULL);
if (ret != 0)
{
eprintf("%s: Failed to init mutex %d, ", __func__, i);
Expand Down Expand Up @@ -84,7 +84,7 @@ int i2cbus_close(i2cbus *dev)
{
for (int i = 0; i < __I2CBUS_MAX_NUM; i++)
{
int ret = pthread_mutex_destroy(&(__i2cbus_lock_ctx[i]));
int ret = pthread_mutex_destroy(&(__i2cbus_locks[i]));
if (ret != 0)
{
eprintf("%s: Failed to destroy mutex %d, ", __func__, i);
Expand Down

0 comments on commit b641381

Please sign in to comment.