summaryrefslogtreecommitdiff
path: root/drivers/w1
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-08-26 02:59:04 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-08-26 03:25:33 +0400
commit58299449257566613f58dcfb757f0ba4a377987a (patch)
tree785b783e2638ae5482a75d15ef4f4e2a2b9790cc /drivers/w1
parent2df7a7d1cd07626dd235ca102830ebfc6c01a09e (diff)
downloadlinux-58299449257566613f58dcfb757f0ba4a377987a.tar.xz
w1: fix for loop in w1_f29_remove_slave()
The for loop was looking for i <= 0 instead of i >= 0 so this function never did anything. Also we started with i = NB_SYSFS_BIN_FILES instead of "NB_SYSFS_BIN_FILES - 1" which is an off by one bug. Reported-by: Bojan Prtvar <prtvar.b@gmail.com> Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Jean-Franois Dagenais <dagenaisj@sonatest.com> Cc: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/slaves/w1_ds2408.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c
index c37781899d90..7c8cdb8aed26 100644
--- a/drivers/w1/slaves/w1_ds2408.c
+++ b/drivers/w1/slaves/w1_ds2408.c
@@ -373,7 +373,7 @@ static int w1_f29_add_slave(struct w1_slave *sl)
static void w1_f29_remove_slave(struct w1_slave *sl)
{
int i;
- for (i = NB_SYSFS_BIN_FILES; i <= 0; --i)
+ for (i = NB_SYSFS_BIN_FILES - 1; i >= 0; --i)
sysfs_remove_bin_file(&sl->dev.kobj,
&(w1_f29_sysfs_bin_files[i]));
}