diff options
-rw-r--r-- | include/linux/srcu.h | 2 | ||||
-rw-r--r-- | kernel/srcu.c | 5 | ||||
-rw-r--r-- | kernel/sys.c | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 8a45367b5f3a..aca0eee53930 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
@@ -43,7 +43,7 @@ struct srcu_struct { | |||
43 | #define srcu_barrier() | 43 | #define srcu_barrier() |
44 | #endif /* #else #ifndef CONFIG_PREEMPT */ | 44 | #endif /* #else #ifndef CONFIG_PREEMPT */ |
45 | 45 | ||
46 | void init_srcu_struct(struct srcu_struct *sp); | 46 | int init_srcu_struct(struct srcu_struct *sp); |
47 | void cleanup_srcu_struct(struct srcu_struct *sp); | 47 | void cleanup_srcu_struct(struct srcu_struct *sp); |
48 | int srcu_read_lock(struct srcu_struct *sp) __acquires(sp); | 48 | int srcu_read_lock(struct srcu_struct *sp) __acquires(sp); |
49 | void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); | 49 | void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); |
diff --git a/kernel/srcu.c b/kernel/srcu.c index 7e1979f624ba..3507cabe963b 100644 --- a/kernel/srcu.c +++ b/kernel/srcu.c | |||
@@ -42,11 +42,12 @@ | |||
42 | * to any other function. Each srcu_struct represents a separate domain | 42 | * to any other function. Each srcu_struct represents a separate domain |
43 | * of SRCU protection. | 43 | * of SRCU protection. |
44 | */ | 44 | */ |
45 | void init_srcu_struct(struct srcu_struct *sp) | 45 | int init_srcu_struct(struct srcu_struct *sp) |
46 | { | 46 | { |
47 | sp->completed = 0; | 47 | sp->completed = 0; |
48 | sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array); | ||
49 | mutex_init(&sp->mutex); | 48 | mutex_init(&sp->mutex); |
49 | sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array); | ||
50 | return (sp->per_cpu_ref ? 0 : -ENOMEM); | ||
50 | } | 51 | } |
51 | 52 | ||
52 | /* | 53 | /* |
diff --git a/kernel/sys.c b/kernel/sys.c index fd5c71006775..98489d82801b 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -517,7 +517,8 @@ EXPORT_SYMBOL_GPL(srcu_notifier_call_chain); | |||
517 | void srcu_init_notifier_head(struct srcu_notifier_head *nh) | 517 | void srcu_init_notifier_head(struct srcu_notifier_head *nh) |
518 | { | 518 | { |
519 | mutex_init(&nh->mutex); | 519 | mutex_init(&nh->mutex); |
520 | init_srcu_struct(&nh->srcu); | 520 | if (init_srcu_struct(&nh->srcu) < 0) |
521 | BUG(); | ||
521 | nh->head = NULL; | 522 | nh->head = NULL; |
522 | } | 523 | } |
523 | 524 | ||