When configfs_register_subsystem fails, we unregister too many subsystems in configfs_example_init. Decrement i by one to not unregister non-registered subsystem. Signed-off-by: Jiri Slaby <jslaby@xxxxxxx> Cc: Joel Becker <joel.becker@xxxxxxxxxx> --- .../configfs/configfs_example_explicit.c | 2 +- .../filesystems/configfs/configfs_example_macros.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/configfs/configfs_example_explicit.c b/Documentation/filesystems/configfs/configfs_example_explicit.c index fd53869..aa8f427 100644 --- a/Documentation/filesystems/configfs/configfs_example_explicit.c +++ b/Documentation/filesystems/configfs/configfs_example_explicit.c @@ -464,7 +464,7 @@ static int __init configfs_example_init(void) return 0; out_unregister: - for (; i >= 0; i--) { + for (i--; i >= 0; i--) { configfs_unregister_subsystem(example_subsys[i]); } diff --git a/Documentation/filesystems/configfs/configfs_example_macros.c b/Documentation/filesystems/configfs/configfs_example_macros.c index d8e30a0..3bcd6e4 100644 --- a/Documentation/filesystems/configfs/configfs_example_macros.c +++ b/Documentation/filesystems/configfs/configfs_example_macros.c @@ -427,7 +427,7 @@ static int __init configfs_example_init(void) return 0; out_unregister: - for (; i >= 0; i--) { + for (i--; i >= 0; i--) { configfs_unregister_subsystem(example_subsys[i]); } -- 1.7.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html