staging: slicoss: return -ENOMEM if kzalloc fail
authorDevendra Naga <devendra.aaru@gmail.com>
Tue, 23 Oct 2012 22:04:32 +0000 (18:04 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Oct 2012 03:28:20 +0000 (20:28 -0700)
this takes up the error path cleanup,
fixes a crash too due to null deref

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/slicoss/slicoss.c

index 945428084914207d7e981603f07375192d4bff0f..f6af3fe46c5e9c34d627ed4f26b8aa07797e0b5d 100644 (file)
@@ -3667,6 +3667,8 @@ static u32 slic_card_locate(struct adapter *adapter)
        if (!physcard) {
                /* no structure allocated for this physical card yet */
                physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC);
+               if (!physcard)
+                       return -ENOMEM;
 
                physcard->next = slic_global.phys_card;
                slic_global.phys_card = physcard;