[bug report] csiostor:T5 Firmware fix and cleanup.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Praveen Madhavan,

The patch 216ce69c7ff5: "csiostor:T5 Firmware fix and cleanup." from
Jan 27, 2015, leads to the following static checker warning:

	drivers/scsi/csiostor/csio_hw.c:2006 csio_hw_use_fwconfig()
	warn: was negative '-ENOENT' intended?

	drivers/scsi/csiostor/csio_hw.c:2433 csio_hw_configure()
	warn: 'rv' is never (-2)

drivers/scsi/csiostor/csio_hw.c
  1994          if (csio_mb_issue(hw, mbp)) {
  1995                  rv = -EINVAL;
  1996                  goto bye;
  1997          }
  1998  
  1999          rv = csio_mb_fw_retval(mbp);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The first warning is a false positive because for some reason Smatch
thinks that csio_mb_fw_retval() always returns zero.  But actually it
returns enum fw_retval.

  2000           /* If the CAPS_CONFIG failed with an ENOENT (for a Firmware
                                                      ^^^^^^
So this should be FW_ENOENT.

  2001            * Configuration File in FLASH), our last gasp effort is to use the
  2002            * Firmware Configuration File which is embedded in the
  2003            * firmware.  A very few early versions of the firmware didn't
  2004            * have one embedded but we can ignore those.
  2005            */
  2006          if (rv == ENOENT) {
                    ^^^^^^^^^^^^
And this as well.  It doesn't affect runtime because ENOENT AND FW_ENOENT
are both 2.

  2007                  CSIO_INIT_MBP(mbp, caps_cmd, CSIO_MB_DEFAULT_TMO, hw, NULL, 1);
  2008                  caps_cmd->op_to_write = htonl(FW_CMD_OP_V(FW_CAPS_CONFIG_CMD) |
  2009                                                FW_CMD_REQUEST_F |
  2010                                                FW_CMD_READ_F);
  2011                  caps_cmd->cfvalid_to_len16 = htonl(FW_LEN16(*caps_cmd));
  2012  
  2013                  if (csio_mb_issue(hw, mbp)) {
  2014                          rv = -EINVAL;
  2015                          goto bye;
  2016                  }
  2017  
  2018                  rv = csio_mb_fw_retval(mbp);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2019                  config_name = "Firmware Default";
  2020          }
  2021          if (rv != FW_SUCCESS)
                    ^^^^^^^^^^^^^^^^
But then this function seems to return a mix of negative kernel error
codes and positive FW_ error codes.  There is a static checker warning
in the caller because we're checking for -ENOENT and Smatch thinks that
isn't possible.  Perhaps we should be checking for positive FW_ENOENT?

It's not super harmful because it only affects which warning is printed.

  2022                  goto bye;
  2023  

regards,
dan carpenter



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux