staging: slicoss: handle allocation failure in slic_init_adapter
authorLino Sanfilippo <LinoSanfilippo@gmx.de>
Thu, 14 Jul 2016 22:13:56 +0000 (00:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 15:58:18 +0000 (17:58 +0200)
commit7ed4eb5168325e52b5d6be277555b36877955c66
tree3cb2d5ce1e67ef8f9016a93ea1a89eba797861d1
parentf56edd42ee69ea73e1ca755614ed6c0e1a6ccef8
staging: slicoss: handle allocation failure in slic_init_adapter

The memory allocation in slic_init_adapter() can fail. Return an error in
this case and unwind properly. Also make sure that the allocated memory is
properly freed in case of an error in the calling probe() function.
By doing this also replace the alloc() followed by memset to zero the
memory with a zalloc() version.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/slicoss/slicoss.c