Skip to contentSkip to conversation

slub: return actual error on sysfs functions

PATCH Applied Jeff Liu 2 participants 2 messages Jun 17, 2014

Subsystems (2)
lore
Share & tools
lore

Jeff Liu

author
#0 lore raw

PATCH 3/24 slub: return actual error on sysfs functions

From: Jie Liu <[email protected]>

Return the actual error code if call kset_create_and_add() failed

Cc Christoph Lameter <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Matt Mackall <[email protected]>
Cc Andrew Morton <[email protected]>
---
 mm/slub.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/slub.c +4 -4
index b2b0473..fc9f5bc 100644
@@ -5215,8 +5215,8 @@ static int sysfs_slab_add(struct kmem_cache *s)
 #ifdef CONFIG_MEMCG_KMEM
 	if (is_root_cache(s)) {
 		s->memcg_kset = kset_create_and_add("cgroup", NULL, &s->kobj);
-		if (!s->memcg_kset) {
-			err = -ENOMEM;
+		if (IS_ERR(s->memcg_kset)) {
+			err = PTR_ERR(s->memcg_kset);
 			goto out_del_kobj;
 		}
 	}
@@ -5298,10 +5298,10 @@ static int __init slab_sysfs_init(void)
 	mutex_lock(&slab_mutex);
 
 	slab_kset = kset_create_and_add("slab", &slab_uevent_ops, kernel_kobj);
-	if (!slab_kset) {
+	if (IS_ERR(slab_kset)) {
 		mutex_unlock(&slab_mutex);
 		pr_err("Cannot register slab subsystem.\n");
-		return -ENOSYS;
+		return PTR_ERR(slab_kset);
 	}
 
 	slab_state = FULL;
Signature · 7 lines
1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
reviewer Acked-by on v1 3/24
#1 lore raw
Quoted 1 line · Jeff Liu

Return the actual error code if call kset_create_and_add() failed

This all looks fine to me aside from the patch sequencing issues mentioned by others.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>