Re: [PATCH 4/6] mpt3sas: Introduce Base function for cloning.

2018-01-23 Thread Suganath Prabu Subramani
Hi All,

We tried to reproduce below error
"drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit
declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);"

with base code and Make file flags (sparse) as mentioned under
reproduce in auto build test log.

We are not seeing this error. We have reviewed the code and it seems
to be fine. Let us know if we miss something here.

base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__

  drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
   drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit
declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
mpt3sas_scsih_issue_locked_tm
   drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment
makes pointer from integer without a cast
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
^
   At top level:
   drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning:
'_clone_sg_entries' defined but not used
static void _clone_sg_entries(struct MPT3SAS_ADAPTER
^
   cc1: some warnings being treated as errors


Thanks,
Suganath Prabu S

On Sat, Jan 20, 2018 at 11:37 PM, kbuild test robot  wrote:
> Hi Suganath,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on scsi/for-next]
> [also build test WARNING on v4.15-rc8 next-20180119]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
> reproduce:
> # apt-get install sparse
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
>
>
> sparse warnings: (new ones prefixed by >>)
>
>>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted 
>>> __le32
>drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in 
> argument 1 (different base types) @@ expected unsigned int val @@ got 
> restrunsigned int val @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val
>drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 
>>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in 
>>> argument 2 (different address spaces) @@ expected void volatile @@ got @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile
>drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS 
> Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs 
> crypto drivers firmware fs include init ipc kernel lib mm net samples scripts 
> security sound tools usr virt
>drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address 
> space of expression
>drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 
> 'mpt3sas_scsih_scsi_lookup_get'
>drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in 
> assignment (different base types) @@ expected unsigned short Event @@ got 
> short Event @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in 
> assignment (different base types) @@ expected unsigned int EventContext @@ 
> got ed int EventContext @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in 
> argument 2 (different address spaces) @@ expected void volatile @@ got oid 
> volatile @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in 
> argument 2 (different address spaces) @@ expected void volatile @@ got oid 
> volatile @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address 
> space of expression
>drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
> argument 1 (different base types) @@ expected unsigned long val @@ got 
> restunsigned long val @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
> argument 1 (different base types) @@ expected unsigned long val @@ got 
> restunsigned long val @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
> argument 1 (different base types) @@ expected unsigned long val @@ got 
> restunsigned long val @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
> argument 1 (different base types) @@ expected unsigned long val @@ got 
> restunsigned long val @@
>drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
> argument 1 (different base types) @@ expected unsigned long val @@ got 
> restunsigned long val @@
>

Re: [PATCH 4/6] mpt3sas: Introduce Base function for cloning.

2018-01-20 Thread kbuild test robot
Hi Suganath,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted 
>> __le32
   drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned int val @@ got 
restrunsigned int val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val
   drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 
>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in 
>> argument 2 (different address spaces) @@ expected void volatile @@ got @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile
   drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS 
Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs 
crypto drivers firmware fs include init ipc kernel lib mm net samples scripts 
security sound tools usr virt
   drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address 
space of expression
   drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 
'mpt3sas_scsih_scsi_lookup_get'
   drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in 
assignment (different base types) @@ expected unsigned short Event @@ got short 
Event @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in 
assignment (different base types) @@ expected unsigned int EventContext @@ got 
ed int EventContext @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in 
argument 2 (different address spaces) @@ expected void volatile @@ got oid 
volatile @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in 
argument 2 (different address spaces) @@ expected void volatile @@ got oid 
volatile @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address 
space of expression
   drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned long val @@ got 
restunsigned long val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned long val @@ got 
restunsigned long val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned long val @@ got 
restunsigned long val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned long val @@ got 
restunsigned long val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned long val @@ got 
restunsigned long val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3411:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned int val @@ got 
restrunsigned int val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3433:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned int val @@ got 
restrunsigned int val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3456:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned int val @@ got 
restrunsigned int val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3477:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned int val @@ got 
restrunsigned int val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:3498:16: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned int val @@ got 
restrunsigned int val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:4950:24: sparse: incorrect type in 
argument 1 (different base types) @@ expected unsigned int val @@ got 
restrunsigned int val @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:4971:20: sparse: cast to restricted 
__le16
   drivers/scsi/mpt3sas/mpt3sas_base.c:4980:20: sparse: cast to restricted 
__le16
   drivers/scsi/mpt3sas/mpt3sas_base.c:4994:36: sparse: cast to restricted 
__le16
   drivers/scsi/mpt3sas/mpt3sas_base.c:6175:55: sparse: incorrect type in 
argument 2 (different address spaces) @@ expected void volatile @@ got oid 
volatile @@
   drivers/scsi/mpt3sas/mpt3sas_base.c:315:53: sparse: call with no type!
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
   drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit 

Re: [PATCH 4/6] mpt3sas: Introduce Base function for cloning.

2018-01-20 Thread kbuild test robot
Hi Suganath,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-i1-201802 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
   drivers/scsi/mpt3sas/mpt3sas_base.c:188:21: warning: cast to pointer from 
integer of different size [-Wint-to-pointer-cast]
 base_chain_phys  = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
^
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
   drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of 
function 'mpt3sas_scsih_scsi_lookup_get'; did you mean 
'mpt3sas_scsih_issue_locked_tm'? [-Werror=implicit-function-declaration]
  scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
 ^
 mpt3sas_scsih_issue_locked_tm
   drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer 
from integer without a cast [-Wint-conversion]
  scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
   ^
>> drivers/scsi/mpt3sas/mpt3sas_base.c:378:20: warning: cast from pointer to 
>> integer of different size [-Wpointer-to-int-cast]
   sgel->Address = (dma_addr_t)dst_addr_phys;
   ^
   drivers/scsi/mpt3sas/mpt3sas_base.c:389:7: warning: cast from pointer to 
integer of different size [-Wpointer-to-int-cast]
  (dma_addr_t)buff_ptr_phys;
  ^
   drivers/scsi/mpt3sas/mpt3sas_base.c:395:10: warning: cast from pointer to 
integer of different size [-Wpointer-to-int-cast]
 (dma_addr_t)buff_ptr_phys;
 ^
   At top level:
   drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' 
defined but not used [-Wunused-function]
static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
^
   cc1: some warnings being treated as errors

vim +378 drivers/scsi/mpt3sas/mpt3sas_base.c

   265  
   266  /**
   267   * _clone_sg_entries -  MPI EP's scsiio and config requests
   268   *  are handled here. Base function for
   269   *  double buffering, before submitting
   270   *  the requests.
   271   *
   272   * @ioc: per adapter object.
   273   * @mpi_request: mf request pointer.
   274   * @smid: system request message index.
   275   *
   276   * @Returns: Nothing.
   277   */
   278  static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
   279  void *mpi_request, u16 smid)
   280  {
   281  Mpi2SGESimple32_t *sgel, *sgel_next;
   282  u32  sgl_flags, sge_chain_count = 0;
   283  bool is_write = 0;
   284  u16 i = 0;
   285  void  *buffer_iomem, *buffer_iomem_phys;
   286  void *buff_ptr, *buff_ptr_phys;
   287  void *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO];
   288  void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys;
   289  MPI2RequestHeader_t *request_hdr;
   290  struct scsi_cmnd *scmd;
   291  struct scatterlist *sg_scmd = NULL;
   292  int is_scsiio_req = 0;
   293  
   294  request_hdr = (MPI2RequestHeader_t *) mpi_request;
   295  
   296  if (request_hdr->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) {
   297  Mpi25SCSIIORequest_t *scsiio_request =
   298  (Mpi25SCSIIORequest_t *)mpi_request;
   299  sgel = (Mpi2SGESimple32_t *) _request->SGL;
   300  is_scsiio_req = 1;
   301  } else if (request_hdr->Function == MPI2_FUNCTION_CONFIG) {
   302  Mpi2ConfigRequest_t  *config_req =
   303  (Mpi2ConfigRequest_t *)mpi_request;
   304  sgel = (Mpi2SGESimple32_t *) _req->PageBufferSGE;
   305  } else
   306  return;
   307  
   308  /* From smid we can get scsi_cmd, once we have sg_scmd,
   309   * we just need to get sg_virt and sg_next to get virual
   310   * address associated with sgel->Address.
   311   */
   312  
   313  if (is_scsiio_req) {
   314  /* Get scsi_cmd using smid */
 > 315  scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
   316  if (scmd == NULL) {
   317  pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name);
   318