diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2015-09-21 12:18:19 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-04 13:55:59 +0200 |
commit | a9e5fe58265d2af5472ea49ec82428e53ac00431 (patch) | |
tree | 7057913f4091ba88adae14e8bbdead5867d88c78 /drivers/misc/sgi-gru/grutlbpurge.c | |
parent | misc: sgi-gru: gruhandles.c: Remove unused function (diff) | |
download | linux-a9e5fe58265d2af5472ea49ec82428e53ac00431.tar.xz linux-a9e5fe58265d2af5472ea49ec82428e53ac00431.zip |
misc: sgi-gru: fix return of error
If kzalloc() fails then gms is NULL and we are returning NULL, but the
functions which called this function gru_register_mmu_notifier() are not
expecting NULL as the return. They are expecting either a valid pointer
or the error code in ERR_PTR.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/sgi-gru/grutlbpurge.c')
-rw-r--r-- | drivers/misc/sgi-gru/grutlbpurge.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c index 757a8e9aabdb..e936d43895d2 100644 --- a/drivers/misc/sgi-gru/grutlbpurge.c +++ b/drivers/misc/sgi-gru/grutlbpurge.c @@ -306,16 +306,16 @@ struct gru_mm_struct *gru_register_mmu_notifier(void) atomic_inc(&gms->ms_refcnt); } else { gms = kzalloc(sizeof(*gms), GFP_KERNEL); - if (gms) { - STAT(gms_alloc); - spin_lock_init(&gms->ms_asid_lock); - gms->ms_notifier.ops = &gru_mmuops; - atomic_set(&gms->ms_refcnt, 1); - init_waitqueue_head(&gms->ms_wait_queue); - err = __mmu_notifier_register(&gms->ms_notifier, current->mm); - if (err) - goto error; - } + if (!gms) + return ERR_PTR(-ENOMEM); + STAT(gms_alloc); + spin_lock_init(&gms->ms_asid_lock); + gms->ms_notifier.ops = &gru_mmuops; + atomic_set(&gms->ms_refcnt, 1); + init_waitqueue_head(&gms->ms_wait_queue); + err = __mmu_notifier_register(&gms->ms_notifier, current->mm); + if (err) + goto error; } if (gms) gru_dbg(grudev, "gms %p, refcnt %d\n", gms, |