• Joe Lawrence's avatar
    mptfusion: tweak null pointer checks · 9f21316f
    Joe Lawrence authored
    Fixes the following smatch warnings:
    
      drivers/message/fusion/mptbase.c:652 mptbase_reply() warn: variable
        dereferenced before check 'reply' (see line 639)
    
          [JL: No-brainer, the enclosing switch statement dereferences
           reply, so we can't get here unless reply is valid.]
    
      drivers/message/fusion/mptsas.c:1255 mptsas_taskmgmt_complete() error:
        we previously assumed 'pScsiTmReply' could be null (see line 1227)
    
          [HCH: Reading the code in mptsas_taskmgmt_complete it's pretty
           obvious that it can't do anything useful if mr/pScsiTmReply are
           NULL, so I suspect it would be best to just return at the
           beginning of the function.
    
           I'd love to understand if it actually could ever be zero, which I
           doubt.  Maybe the LSI people can shed some light on that?]
    
      drivers/message/fusion/mptsas.c:3888 mptsas_not_responding_devices()
        error: we previously assumed 'port_info->phy_info' could be null
        (see line 3875)
    
          [HCH: It's pretty obvious from reading mptsas_sas_io_unit_pg0 that
           we never register a port_info with a NULL phy_info in the lists,
           so all NULL checks on it could be deleted.]
    
      drivers/message/fusion/mptscsih.c:1284 mptscsih_info() error:
        we previously assumed 'h' could be null (see line 1274)
    
          [HCH: shost_priv can't return NULL, so the if (h) should be
           removed.]
    
      drivers/message/fusion/mptscsih.c:1388 mptscsih_qcmd() error: we
        previously assumed 'vdevice' could be null (see line 1373)
    
          [HCH: vdevice can't ever be NULL here, it's allocated in
           ->slave_alloc and thus guaranteed to be around when
           ->queuecommand is called.]
    Signed-off-by: default avatarJoe Lawrence <joe.lawrence@stratus.com>
    Acked-by: default avatarSreekanth Reddy <Sreekanth.Reddy@avagotech.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    9f21316f
mptscsih.c 91 KB