From 5619d7e84d03117c2d64121e5527f562d40be2b9 Mon Sep 17 00:00:00 2001 From: Frederic Weisbecker Date: Fri, 2 Dec 2011 14:12:56 +1100 Subject: [PATCH] res_counter: allow charge failure pointer to be null So that callers of res_counter_charge() don't have to create and pass this pointer even if they aren't interested in it. Signed-off-by: Frederic Weisbecker Cc: Paul Menage Cc: Li Zefan Cc: Johannes Weiner Cc: Aditya Kali Cc: Oleg Nesterov Cc: Kay Sievers Cc: Tim Hockin Cc: Tejun Heo Acked-by: Kirill A. Shutemov Signed-off-by: Andrew Morton --- kernel/res_counter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/res_counter.c b/kernel/res_counter.c index 8f4c728ccee0..6b36823541ba 100644 --- a/kernel/res_counter.c +++ b/kernel/res_counter.c @@ -43,14 +43,16 @@ int res_counter_charge_until(struct res_counter *counter, unsigned long flags; struct res_counter *c, *u; - *limit_fail_at = NULL; + if (limit_fail_at) + *limit_fail_at = NULL; local_irq_save(flags); for (c = counter; c != limit; c = c->parent) { spin_lock(&c->lock); ret = res_counter_charge_locked(c, val); spin_unlock(&c->lock); if (ret < 0) { - *limit_fail_at = c; + if (limit_fail_at) + *limit_fail_at = c; goto undo; } } -- 2.39.5