From: Frederic Weisbecker Date: Wed, 5 Oct 2011 00:43:47 +0000 (+1100) Subject: res_counter: allow charge failure pointer to be null X-Git-Tag: next-20111005~2^2~55 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f8f2b1b1a98f0a837aa82336cfaaa0c4ad08cd8b;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; } }