From: Frederic Weisbecker Date: Thu, 8 Dec 2011 04:42:37 +0000 (+1100) Subject: res_counter: allow charge failure pointer to be null X-Git-Tag: next-20111209~3^2~65 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7730889346c0951f7606a9bea323ed785a88e655;p=karo-tx-linux.git 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 --- 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; } }