diff options
author | Hannes Reinecke <hare@suse.de> | 2019-02-18 02:34:20 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-02-25 21:37:25 -0500 |
commit | 33d6667416c73eb0b37f0f10f56d825b15389dab (patch) | |
tree | db98e8010ec912be28221caf016d3488bd64a6d0 /drivers/scsi/3w-9xxx.c | |
parent | 56de8357049c707e5c881cc9d0e5ffed76388423 (diff) |
scsi: 3w-9xxx: fix calls to dma_set_mask_and_coherent()
The change to use dma_set_mask_and_coherent() incorrectly made a second
call with the 32 bit DMA mask value when the call with the 64 bit DMA mask
value succeeded.
Fixes: b000bced5739 ("scsi: 3w-9xxx: fully convert to the generic DMA API")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/3w-9xxx.c')
-rw-r--r-- | drivers/scsi/3w-9xxx.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index a3c20e3a8b7c..3337b1e80412 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) | |||
2009 | struct Scsi_Host *host = NULL; | 2009 | struct Scsi_Host *host = NULL; |
2010 | TW_Device_Extension *tw_dev; | 2010 | TW_Device_Extension *tw_dev; |
2011 | unsigned long mem_addr, mem_len; | 2011 | unsigned long mem_addr, mem_len; |
2012 | int retval = -ENODEV; | 2012 | int retval; |
2013 | 2013 | ||
2014 | retval = pci_enable_device(pdev); | 2014 | retval = pci_enable_device(pdev); |
2015 | if (retval) { | 2015 | if (retval) { |
@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) | |||
2020 | pci_set_master(pdev); | 2020 | pci_set_master(pdev); |
2021 | pci_try_set_mwi(pdev); | 2021 | pci_try_set_mwi(pdev); |
2022 | 2022 | ||
2023 | if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | 2023 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
2024 | dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | 2024 | if (retval) |
2025 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
2026 | if (retval) { | ||
2025 | TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); | 2027 | TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); |
2026 | retval = -ENODEV; | 2028 | retval = -ENODEV; |
2027 | goto out_disable_device; | 2029 | goto out_disable_device; |
@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev) | |||
2240 | pci_set_master(pdev); | 2242 | pci_set_master(pdev); |
2241 | pci_try_set_mwi(pdev); | 2243 | pci_try_set_mwi(pdev); |
2242 | 2244 | ||
2243 | if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | 2245 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
2244 | dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | 2246 | if (retval) |
2247 | retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
2248 | if (retval) { | ||
2245 | TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); | 2249 | TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); |
2246 | retval = -ENODEV; | 2250 | retval = -ENODEV; |
2247 | goto out_disable_device; | 2251 | goto out_disable_device; |