From 0224511877b3c5b37f484401e06e3ca331169a9c Mon Sep 17 00:00:00 2001
From: Devendra Naga <devendra.aaru@gmail.com>
Date: Tue, 23 Oct 2012 18:04:32 -0400
Subject: [PATCH] staging: slicoss: return -ENOMEM if kzalloc fail

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 9454280849142..f6af3fe46c5e9 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -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;
-- 
2.39.5