提交 58299449 编写于 作者: D Dan Carpenter 提交者: 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: NBojan Prtvar <prtvar.b@gmail.com>
Signed-off-by: NDan Carpenter <error27@gmail.com>
Acked-by: NJean-Franois Dagenais <dagenaisj@sonatest.com>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册