From: Wei Yongjun <[email protected]>

The dereference should be moved below the NULL test.

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <[email protected]>
---
 drivers/scsi/bfa/bfad_im.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 2eebf8d..e778f35 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -951,13 +951,15 @@ static int
 bfad_im_slave_alloc(struct scsi_device *sdev)
 {
        struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
-       struct bfad_itnim_data_s *itnim_data =
-                               (struct bfad_itnim_data_s *) rport->dd_data;
-       struct bfa_s *bfa = itnim_data->itnim->bfa_itnim->bfa;
+       struct bfad_itnim_data_s *itnim_data;
+       struct bfa_s *bfa;
 
        if (!rport || fc_remote_port_chkready(rport))
                return -ENXIO;
 
+       itnim_data = (struct bfad_itnim_data_s *)rport->dd_data;
+       bfa = itnim_data->itnim->bfa_itnim->bfa;
+
        if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) {
                /*
                 * We should not mask LUN 0 - since this will translate


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to