aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2014-06-16 15:00:00 -0400
committerJonathan Cameron <jic23@kernel.org>2014-06-16 15:57:36 -0400
commit88f6da779a37a3579e580296776ba86d6c6bd980 (patch)
tree04a5b42f213d57db90743d1898d23ff62ab39396
parentd14c0f10e71c174cc312fb77832450bd02171be5 (diff)
iio: accel: kxcjk1013 Fix missing unlock errors
Fix unlock at two places. One when i2c error occurs and other when trigger set state when raw read is in progress. kbuild test robot errors: >> >> drivers/iio/accel/kxcjk-1013.c:531:3-9: preceding lock on line 524 >> >> drivers/iio/accel/kxcjk-1013.c:376:4-10: preceding lock on line 368 Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/accel/kxcjk-1013.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 2326e430c999..72a6dbbc18d1 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -372,8 +372,10 @@ static int kxcjk1013_read_raw(struct iio_dev *indio_dev,
372 int sleep_val; 372 int sleep_val;
373 373
374 ret = kxcjk1013_set_mode(data, OPERATION); 374 ret = kxcjk1013_set_mode(data, OPERATION);
375 if (ret < 0) 375 if (ret < 0) {
376 mutex_unlock(&data->mutex);
376 return ret; 377 return ret;
378 }
377 ++data->power_state; 379 ++data->power_state;
378 sleep_val = kxcjk1013_get_startup_times(data); 380 sleep_val = kxcjk1013_get_startup_times(data);
379 if (sleep_val < 20000) 381 if (sleep_val < 20000)
@@ -527,8 +529,10 @@ static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig,
527 kxcjk1013_set_mode(data, OPERATION); 529 kxcjk1013_set_mode(data, OPERATION);
528 ++data->power_state; 530 ++data->power_state;
529 } else { 531 } else {
530 if (--data->power_state) 532 if (--data->power_state) {
533 mutex_unlock(&data->mutex);
531 return 0; 534 return 0;
535 }
532 kxcjk1013_chip_setup_interrupt(data, false); 536 kxcjk1013_chip_setup_interrupt(data, false);
533 kxcjk1013_set_mode(data, STANDBY); 537 kxcjk1013_set_mode(data, STANDBY);
534 } 538 }