diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-10-17 02:25:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:44 -0400 |
commit | 833f4077bf7c2dcff6e31526e03ec2ad91c88581 (patch) | |
tree | 80916540be846267342c3e5e4a6255c2c18b44d5 /include/linux/percpu_counter.h | |
parent | bf1d89c81352f6eca72d0c10cfee3dba29ef5efb (diff) |
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>
Diffstat (limited to 'include/linux/percpu_counter.h')
-rw-r--r-- | include/linux/percpu_counter.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 21e054595bcb..f7ecd38d7e9c 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h | |||
@@ -30,7 +30,7 @@ struct percpu_counter { | |||
30 | #define FBC_BATCH (NR_CPUS*4) | 30 | #define FBC_BATCH (NR_CPUS*4) |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | void percpu_counter_init(struct percpu_counter *fbc, s64 amount); | 33 | int percpu_counter_init(struct percpu_counter *fbc, s64 amount); |
34 | void percpu_counter_destroy(struct percpu_counter *fbc); | 34 | void percpu_counter_destroy(struct percpu_counter *fbc); |
35 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); | 35 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); |
36 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); | 36 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); |
@@ -78,9 +78,10 @@ struct percpu_counter { | |||
78 | s64 count; | 78 | s64 count; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount) | 81 | static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) |
82 | { | 82 | { |
83 | fbc->count = amount; | 83 | fbc->count = amount; |
84 | return 0; | ||
84 | } | 85 | } |
85 | 86 | ||
86 | static inline void percpu_counter_destroy(struct percpu_counter *fbc) | 87 | static inline void percpu_counter_destroy(struct percpu_counter *fbc) |