aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2007-09-29 12:16:28 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:52:11 -0400
commitbc6e089a13a5c0ac36247616baecd6fc77405e7f (patch)
tree1550844191351e970b10c94379146f624e02f599 /drivers/message
parente7eae9f6e94cd49261c2997b0b4f768c1351bc02 (diff)
[SCSI] mpt fusion: Fix sparse warnings
List below is output from C=2 sparse compilation, which are fixed with this patch. 1) mptspi: pg0 is defined in x86 version of include/asm/pgtable.h 2) mptsas: context imbalance in 'mptsas_probe' different lock contexts for basic block 3) mptbase: from mpt_attach - cast adds address space to expression 4) mptbase: from mpt_do_upload - request[] is bad constant expression Signed-off-by: Eric Moore <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c27
-rw-r--r--drivers/message/fusion/mptsas.c1
-rw-r--r--drivers/message/fusion/mptspi.c22
3 files changed, 28 insertions, 22 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5987f8b6a59b..52fb216dfe74 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1452,6 +1452,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1452{ 1452{
1453 MPT_ADAPTER *ioc; 1453 MPT_ADAPTER *ioc;
1454 u8 __iomem *mem; 1454 u8 __iomem *mem;
1455 u8 __iomem *pmem;
1455 unsigned long mem_phys; 1456 unsigned long mem_phys;
1456 unsigned long port; 1457 unsigned long port;
1457 u32 msize; 1458 u32 msize;
@@ -1576,11 +1577,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1576 ioc->chip = (SYSIF_REGS __iomem *)mem; 1577 ioc->chip = (SYSIF_REGS __iomem *)mem;
1577 1578
1578 /* Save Port IO values in case we need to do downloadboot */ 1579 /* Save Port IO values in case we need to do downloadboot */
1579 { 1580 ioc->pio_mem_phys = port;
1580 u8 *pmem = (u8*)port; 1581 pmem = (u8 __iomem *)port;
1581 ioc->pio_mem_phys = port; 1582 ioc->pio_chip = (SYSIF_REGS __iomem *)pmem;
1582 ioc->pio_chip = (SYSIF_REGS __iomem *)pmem;
1583 }
1584 1583
1585 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); 1584 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
1586 mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name); 1585 mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name);
@@ -3103,7 +3102,6 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
3103static int 3102static int
3104mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) 3103mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3105{ 3104{
3106 u8 request[ioc->req_sz];
3107 u8 reply[sizeof(FWUploadReply_t)]; 3105 u8 reply[sizeof(FWUploadReply_t)];
3108 FWUpload_t *prequest; 3106 FWUpload_t *prequest;
3109 FWUploadReply_t *preply; 3107 FWUploadReply_t *preply;
@@ -3129,11 +3127,16 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3129 return -ENOMEM; 3127 return -ENOMEM;
3130 } 3128 }
3131 3129
3132 prequest = (FWUpload_t *)&request; 3130 prequest = (sleepFlag == NO_SLEEP) ? kzalloc(ioc->req_sz, GFP_ATOMIC) :
3133 preply = (FWUploadReply_t *)&reply; 3131 kzalloc(ioc->req_sz, GFP_KERNEL);
3132 if (!prequest) {
3133 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "fw upload failed "
3134 "while allocating memory \n", ioc->name));
3135 mpt_free_fw_memory(ioc);
3136 return -ENOMEM;
3137 }
3134 3138
3135 /* Destination... */ 3139 preply = (FWUploadReply_t *)&reply;
3136 memset(prequest, 0, ioc->req_sz);
3137 3140
3138 reply_sz = sizeof(reply); 3141 reply_sz = sizeof(reply);
3139 memset(preply, 0, reply_sz); 3142 memset(preply, 0, reply_sz);
@@ -3145,11 +3148,12 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3145 ptcsge->DetailsLength = 12; 3148 ptcsge->DetailsLength = 12;
3146 ptcsge->Flags = MPI_SGE_FLAGS_TRANSACTION_ELEMENT; 3149 ptcsge->Flags = MPI_SGE_FLAGS_TRANSACTION_ELEMENT;
3147 ptcsge->ImageSize = cpu_to_le32(sz); 3150 ptcsge->ImageSize = cpu_to_le32(sz);
3151 ptcsge++;
3148 3152
3149 sgeoffset = sizeof(FWUpload_t) - sizeof(SGE_MPI_UNION) + sizeof(FWUploadTCSGE_t); 3153 sgeoffset = sizeof(FWUpload_t) - sizeof(SGE_MPI_UNION) + sizeof(FWUploadTCSGE_t);
3150 3154
3151 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ | sz; 3155 flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ | sz;
3152 mpt_add_sge(&request[sgeoffset], flagsLength, ioc->cached_fw_dma); 3156 mpt_add_sge((char *)ptcsge, flagsLength, ioc->cached_fw_dma);
3153 3157
3154 sgeoffset += sizeof(u32) + sizeof(dma_addr_t); 3158 sgeoffset += sizeof(u32) + sizeof(dma_addr_t);
3155 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": Sending FW Upload (req @ %p) sgeoffset=%d \n", 3159 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": Sending FW Upload (req @ %p) sgeoffset=%d \n",
@@ -3184,6 +3188,7 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3184 ioc->name)); 3188 ioc->name));
3185 mpt_free_fw_memory(ioc); 3189 mpt_free_fw_memory(ioc);
3186 } 3190 }
3191 kfree(prequest);
3187 3192
3188 return cmdStatus; 3193 return cmdStatus;
3189} 3194}
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index adbdbd45e0c9..4c641c6f98a6 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -3224,6 +3224,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3224 hd->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC); 3224 hd->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC);
3225 if (!hd->ScsiLookup) { 3225 if (!hd->ScsiLookup) {
3226 error = -ENOMEM; 3226 error = -ENOMEM;
3227 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
3227 goto out_mptsas_probe; 3228 goto out_mptsas_probe;
3228 } 3229 }
3229 3230
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 3c24928e3cec..ed6a778b6707 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -516,8 +516,8 @@ static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
516 struct Scsi_Host *shost = dev_to_shost(&starget->dev); 516 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
517 struct _MPT_SCSI_HOST *hd = shost_priv(shost); 517 struct _MPT_SCSI_HOST *hd = shost_priv(shost);
518 struct _MPT_ADAPTER *ioc = hd->ioc; 518 struct _MPT_ADAPTER *ioc = hd->ioc;
519 struct _CONFIG_PAGE_SCSI_DEVICE_0 *pg0; 519 struct _CONFIG_PAGE_SCSI_DEVICE_0 *spi_dev_pg0;
520 dma_addr_t pg0_dma; 520 dma_addr_t spi_dev_pg0_dma;
521 int size; 521 int size;
522 struct _x_config_parms cfg; 522 struct _x_config_parms cfg;
523 struct _CONFIG_PAGE_HEADER hdr; 523 struct _CONFIG_PAGE_HEADER hdr;
@@ -535,8 +535,8 @@ static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
535 size += 2048; 535 size += 2048;
536 */ 536 */
537 537
538 pg0 = dma_alloc_coherent(&ioc->pcidev->dev, size, &pg0_dma, GFP_KERNEL); 538 spi_dev_pg0 = dma_alloc_coherent(&ioc->pcidev->dev, size, &spi_dev_pg0_dma, GFP_KERNEL);
539 if (pg0 == NULL) { 539 if (spi_dev_pg0 == NULL) {
540 starget_printk(MYIOC_s_ERR_FMT, starget, 540 starget_printk(MYIOC_s_ERR_FMT, starget,
541 "dma_alloc_coherent for parameters failed\n", ioc->name); 541 "dma_alloc_coherent for parameters failed\n", ioc->name);
542 return -EINVAL; 542 return -EINVAL;
@@ -552,7 +552,7 @@ static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
552 memset(&cfg, 0, sizeof(cfg)); 552 memset(&cfg, 0, sizeof(cfg));
553 553
554 cfg.cfghdr.hdr = &hdr; 554 cfg.cfghdr.hdr = &hdr;
555 cfg.physAddr = pg0_dma; 555 cfg.physAddr = spi_dev_pg0_dma;
556 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; 556 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
557 cfg.dir = 0; 557 cfg.dir = 0;
558 cfg.pageAddr = starget->id; 558 cfg.pageAddr = starget->id;
@@ -562,12 +562,12 @@ static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
562 goto out_free; 562 goto out_free;
563 } 563 }
564 err = 0; 564 err = 0;
565 memcpy(pass_pg0, pg0, size); 565 memcpy(pass_pg0, spi_dev_pg0, size);
566 566
567 mptspi_print_read_nego(hd, starget, le32_to_cpu(pg0->NegotiatedParameters)); 567 mptspi_print_read_nego(hd, starget, le32_to_cpu(spi_dev_pg0->NegotiatedParameters));
568 568
569 out_free: 569 out_free:
570 dma_free_coherent(&ioc->pcidev->dev, size, pg0, pg0_dma); 570 dma_free_coherent(&ioc->pcidev->dev, size, spi_dev_pg0, spi_dev_pg0_dma);
571 return err; 571 return err;
572} 572}
573 573
@@ -594,11 +594,11 @@ static u32 mptspi_getRP(struct scsi_target *starget)
594static void mptspi_read_parameters(struct scsi_target *starget) 594static void mptspi_read_parameters(struct scsi_target *starget)
595{ 595{
596 int nego; 596 int nego;
597 struct _CONFIG_PAGE_SCSI_DEVICE_0 pg0; 597 struct _CONFIG_PAGE_SCSI_DEVICE_0 spi_dev_pg0;
598 598
599 mptspi_read_spi_device_pg0(starget, &pg0); 599 mptspi_read_spi_device_pg0(starget, &spi_dev_pg0);
600 600
601 nego = le32_to_cpu(pg0.NegotiatedParameters); 601 nego = le32_to_cpu(spi_dev_pg0.NegotiatedParameters);
602 602
603 spi_iu(starget) = (nego & MPI_SCSIDEVPAGE0_NP_IU) ? 1 : 0; 603 spi_iu(starget) = (nego & MPI_SCSIDEVPAGE0_NP_IU) ? 1 : 0;
604 spi_dt(starget) = (nego & MPI_SCSIDEVPAGE0_NP_DT) ? 1 : 0; 604 spi_dt(starget) = (nego & MPI_SCSIDEVPAGE0_NP_DT) ? 1 : 0;