• L
    scsi: hisi_sas: Fix the code logic issue of NULL pointer check about sas_port... · 308d30fb
    luojiaxing 提交于
    scsi: hisi_sas: Fix the code logic issue of NULL pointer check about sas_port in func:hisi_sas_task_prep
    
    sas_port is a pointer passed by device->port,it accept non-zero check
    before running ahead to prevent a null pointer to be passed on.
    
    but some logic issue exist here that sas_port(device->port) was used before
    non-zero check,such as func: dev_to_hisi_hba lay on line 290
    
    290 struct hisi_hba #hisi_hba = dev_to_hisi_hba(device)
                                        ^
    The code of function:dev_to_hisi_hib is as blow:
    
    return device->port->ha->lldd_ha;
    
    Obviously,device->port is used before non-zero check for non-zero check
    begin at line 303 but dev_to_hisi_hba lay on line 290;
    
    so,to fix this bug,I need to shift some code and make sure sas_port
    which was used after non-zero check.
    Signed-off-by: Nluojiaxing <luojiaxing@huawei.com>
    Signed-off-by: NJohn Garry <john.garry@huawei.com>
    308d30fb
hisi_sas_main.c 64.4 KB