aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-06-04 05:04:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-06-12 19:58:33 -0400
commit0c6d5c89a112620d2166b8d042d3d69bb42b626c (patch)
tree7256aae1b6ba79b7f040bfada4bec7c2e1a673f0 /drivers/w1
parenta14ef24b07b63669d58c16d836ddbadcce3e7ad0 (diff)
w1: use correct lock on error in w1_seq_show()
I noticed there was a problem here because Smatch complained: drivers/w1/slaves/w1_therm.c:416 w1_seq_show() warn: inconsistent returns 'mutex:&sl->master->mutex'. Locked on: line 416 Unlocked on: line 413 The problem is that we lock ->mutex but we unlock ->bus_mutex on error. David Fries says that ->bus_mutex is correct and ->mutex is incorrect. Fixes: d9411e57dc7f ('w1: Add support for DS28EA00 sequence to w1-therm') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/slaves/w1_therm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 3351be667957..2f029e8f4f95 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -355,7 +355,7 @@ static ssize_t w1_seq_show(struct device *device,
355 struct w1_reg_num *reg_num; 355 struct w1_reg_num *reg_num;
356 int seq = 0; 356 int seq = 0;
357 357
358 mutex_lock(&sl->master->mutex); 358 mutex_lock(&sl->master->bus_mutex);
359 /* Place all devices in CHAIN state */ 359 /* Place all devices in CHAIN state */
360 if (w1_reset_bus(sl->master)) 360 if (w1_reset_bus(sl->master))
361 goto error; 361 goto error;
@@ -407,7 +407,7 @@ static ssize_t w1_seq_show(struct device *device,
407 ack = w1_read_8(sl->master); 407 ack = w1_read_8(sl->master);
408 if (ack != W1_42_SUCCESS_CONFIRM_BYTE) 408 if (ack != W1_42_SUCCESS_CONFIRM_BYTE)
409 goto error; 409 goto error;
410 mutex_unlock(&sl->master->mutex); 410 mutex_unlock(&sl->master->bus_mutex);
411 411
412 c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq); 412 c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq);
413 return PAGE_SIZE - c; 413 return PAGE_SIZE - c;