lib: percpu_counter_init error handling

alloc_percpu can fail, propagate that error.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Peter Zijlstra
2007-10-16 23:25:45 -07:00
committed by Linus Torvalds
parent bf1d89c813
commit 833f4077bf
5 changed files with 52 additions and 18 deletions

View File

@@ -30,7 +30,7 @@ struct percpu_counter {
#define FBC_BATCH (NR_CPUS*4)
#endif
void percpu_counter_init(struct percpu_counter *fbc, s64 amount);
int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
void percpu_counter_destroy(struct percpu_counter *fbc);
void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
@@ -78,9 +78,10 @@ struct percpu_counter {
s64 count;
};
static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount)
static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
{
fbc->count = amount;
return 0;
}
static inline void percpu_counter_destroy(struct percpu_counter *fbc)