drivers: lustre: ldlm: check result of register_shrinker()
authorAliaksei Karaliou <akaraliou.dev@gmail.com>
Thu, 7 Dec 2017 07:25:52 +0000 (10:25 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Dec 2017 11:37:50 +0000 (12:37 +0100)
ldlm_pools_init() does not check result of register_shrinker()
which was tagged __must_check recently, reported by sparse.

Signed-off-by: Aliaksei Karaliou <akaraliou.dev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c

index da65d00..8563bd3 100644 (file)
@@ -1086,8 +1086,12 @@ int ldlm_pools_init(void)
        int rc;
 
        rc = ldlm_pools_thread_start();
-       if (rc == 0)
-               register_shrinker(&ldlm_pools_cli_shrinker);
+       if (rc)
+               return rc;
+
+       rc = register_shrinker(&ldlm_pools_cli_shrinker);
+       if (rc)
+               ldlm_pools_thread_stop();
 
        return rc;
 }