diff options
author | Eric Moore <eric.moore@lsi.com> | 2007-09-29 12:16:28 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:52:11 -0400 |
commit | bc6e089a13a5c0ac36247616baecd6fc77405e7f (patch) | |
tree | 1550844191351e970b10c94379146f624e02f599 /drivers/message/fusion/mptbase.c | |
parent | e7eae9f6e94cd49261c2997b0b4f768c1351bc02 (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/fusion/mptbase.c')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 27 |
1 files changed, 16 insertions, 11 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) | |||
3103 | static int | 3102 | static int |
3104 | mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) | 3103 | mpt_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 | } |