lpfc: fix memory leak and NULL dereference
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Wed, 23 Sep 2015 13:32:32 +0000 (19:02 +0530)
committerJames Bottomley <JBottomley@Odin.com>
Tue, 10 Nov 2015 01:08:03 +0000 (17:08 -0800)
commite79504236548e4c909959ba444f87a12224555ac
tree645f887cadd3c3fefd4c697d83a2d3c0dc3be9af
parent481ebb3daac39c6c1a8f78f98b823a9c9591616f
lpfc: fix memory leak and NULL dereference

kmalloc() can return NULL and without checking we were dereferencing it.
Moreover if kmalloc succeeds but the function fails in other parts then
we were returning the error code but we missed freeing lcb_context.
While at it fixed one related checkpatch warning.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: James Smart <james.smart@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/lpfc/lpfc_els.c