sptlrpc_enc_pool_init() does not check result of register_shrinker()
which was tagged __must_check recently, reported by sparse.

Signed-off-by: Aliaksei Karaliou <akaraliou....@gmail.com>
---
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

v3: Style fixes, as suggested by Andreas Cheers, Dan Carpenter and Greg KH.

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
index 77a3721beaee..134ee727e8b7 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
@@ -396,6 +396,8 @@ static struct shrinker pools_shrinker = {
 
 int sptlrpc_enc_pool_init(void)
 {
+       int rc;
+
        /*
         * maximum capacity is 1/8 of total physical memory.
         * is the 1/8 a good number?
@@ -432,9 +434,11 @@ int sptlrpc_enc_pool_init(void)
        if (!page_pools.epp_pools)
                return -ENOMEM;
 
-       register_shrinker(&pools_shrinker);
+       rc = register_shrinker(&pools_shrinker);
+       if (rc)
+               enc_pools_free();
 
-       return 0;
+       return rc;
 }
 
 void sptlrpc_enc_pool_fini(void)
-- 
2.11.0

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to