From b91b22ae5577d5bcd430e87a572811124e54b97b Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Wed, 4 Oct 2006 02:17:05 -0700 Subject: [PATCH] --- yaml --- r: 38445 b: refs/heads/master c: e6a92013ba458804161c0c5b6d134d82204dc233 h: refs/heads/master i: 38443: dea263699416b0fad1fb98bd8b0a27c2d019c7a2 v: v3 --- [refs] | 2 +- trunk/include/linux/srcu.h | 2 +- trunk/kernel/srcu.c | 5 +++-- trunk/kernel/sys.c | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index ce88a7d0d10a..f6e7af3ead19 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: eabc069401bcf45bcc3f19e643017bf761780aa8 +refs/heads/master: e6a92013ba458804161c0c5b6d134d82204dc233 diff --git a/trunk/include/linux/srcu.h b/trunk/include/linux/srcu.h index 8a45367b5f3a..aca0eee53930 100644 --- a/trunk/include/linux/srcu.h +++ b/trunk/include/linux/srcu.h @@ -43,7 +43,7 @@ struct srcu_struct { #define srcu_barrier() #endif /* #else #ifndef CONFIG_PREEMPT */ -void init_srcu_struct(struct srcu_struct *sp); +int init_srcu_struct(struct srcu_struct *sp); void cleanup_srcu_struct(struct srcu_struct *sp); int srcu_read_lock(struct srcu_struct *sp) __acquires(sp); void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); diff --git a/trunk/kernel/srcu.c b/trunk/kernel/srcu.c index 7e1979f624ba..3507cabe963b 100644 --- a/trunk/kernel/srcu.c +++ b/trunk/kernel/srcu.c @@ -42,11 +42,12 @@ * to any other function. Each srcu_struct represents a separate domain * of SRCU protection. */ -void init_srcu_struct(struct srcu_struct *sp) +int init_srcu_struct(struct srcu_struct *sp) { sp->completed = 0; - sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array); mutex_init(&sp->mutex); + sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array); + return (sp->per_cpu_ref ? 0 : -ENOMEM); } /* diff --git a/trunk/kernel/sys.c b/trunk/kernel/sys.c index fd5c71006775..98489d82801b 100644 --- a/trunk/kernel/sys.c +++ b/trunk/kernel/sys.c @@ -517,7 +517,8 @@ EXPORT_SYMBOL_GPL(srcu_notifier_call_chain); void srcu_init_notifier_head(struct srcu_notifier_head *nh) { mutex_init(&nh->mutex); - init_srcu_struct(&nh->srcu); + if (init_srcu_struct(&nh->srcu) < 0) + BUG(); nh->head = NULL; }