[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180104000853.1142-1-sxwjean@gmail.com>
Date: Thu, 4 Jan 2018 08:08:53 +0800
From: Xiongwei Song <sxwjean@...il.com>
To: gregkh@...uxfoundation.org, arve@...roid.com, tkjos@...roid.com,
maco@...roid.com
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: android: check the return value of register_shrinker
register_shrinker call is made in ashmem_init, it may return error code,
so we need to check it.
Signed-off-by: Xiongwei Song <sxwjean@...il.com>
---
drivers/staging/android/ashmem.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 4e8947923904..0b23c3e25cd4 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -854,12 +854,18 @@ static int __init ashmem_init(void)
goto out_free2;
}
- register_shrinker(&ashmem_shrinker);
+ ret = register_shrinker(&ashmem_shrinker);
+ if (unlikely(ret)) {
+ pr_err("failed to register shrinker!\n");
+ goto out_demisc;
+ }
pr_info("initialized\n");
return 0;
+out_demisc:
+ misc_deregister(&ashmem_misc);
out_free2:
kmem_cache_destroy(ashmem_range_cachep);
out_free1:
--
2.15.1
Powered by blists - more mailing lists