Commit 58299449 authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Torvalds

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: default avatarBojan Prtvar <prtvar.b@gmail.com>
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarJean-Franois Dagenais <dagenaisj@sonatest.com>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2df7a7d1
...@@ -373,7 +373,7 @@ static int w1_f29_add_slave(struct w1_slave *sl) ...@@ -373,7 +373,7 @@ static int w1_f29_add_slave(struct w1_slave *sl)
static void w1_f29_remove_slave(struct w1_slave *sl) static void w1_f29_remove_slave(struct w1_slave *sl)
{ {
int i; 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, sysfs_remove_bin_file(&sl->dev.kobj,
&(w1_f29_sysfs_bin_files[i])); &(w1_f29_sysfs_bin_files[i]));
} }
......
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