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>
This commit is contained in:
Devendra Naga 2012-10-23 18:04:32 -04:00 коммит произвёл Greg Kroah-Hartman
Родитель 7fc465b106
Коммит 0608882d01
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

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