Skip to content

Commit

Permalink
w1: fix for loop in w1_f29_remove_slave()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Jean-Franois Dagenais <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
error27 authored and torvalds committed Aug 25, 2011
1 parent 2df7a7d commit 5829944
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/w1/slaves/w1_ds2408.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
Expand Down

0 comments on commit 5829944

Please sign in to comment.