From 33fff97cbdc1246d59f64614e0081e393c484d02 Mon Sep 17 00:00:00 2001 From: Li Heng Date: Wed, 29 Jul 2020 17:19:14 +0800 Subject: scsi: mptfc: Remove unneeded cast from memory allocation Remove casting the values returned by memory allocation function. Coccinelle emits WARNING: ./drivers/message/fusion/mptfc.c:766:17-30: WARNING: casting value returned by memory allocation function to (FCPortPage0_t *) is useless. ./drivers/message/fusion/mptfc.c:907:17-30: WARNING: casting value returned by memory allocation function to (FCPortPage1_t *) is useless. [mkp: memset()] Link: https://lore.kernel.org/r/1596014354-59935-1-git-send-email-liheng40@huawei.com Signed-off-by: Li Heng Signed-off-by: Martin K. Petersen --- drivers/message/fusion/mptfc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/message') diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index 4314a3352b96..f92b0433f599 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c @@ -763,7 +763,7 @@ mptfc_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) data_sz = hdr.PageLength * 4; rc = -ENOMEM; - ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma); + ppage0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma); if (ppage0_alloc) { try_again: @@ -904,7 +904,7 @@ start_over: if (data_sz < sizeof(FCPortPage1_t)) data_sz = sizeof(FCPortPage1_t); - page1_alloc = (FCPortPage1_t *) pci_alloc_consistent(ioc->pcidev, + page1_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page1_dma); if (!page1_alloc) @@ -922,8 +922,6 @@ start_over: } } - memset(page1_alloc,0,data_sz); - cfg.physAddr = page1_dma; cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; -- cgit v1.2.3 From 8fee79ed8ea23c241e55fb5f6fd935d330f074f6 Mon Sep 17 00:00:00 2001 From: Li Heng Date: Wed, 29 Jul 2020 17:19:50 +0800 Subject: scsi: mptctl: Remove unneeded cast from memory allocation Remove casting the values returned by memory allocation function. Coccinelle emits WARNING: ./drivers/message/fusion/mptctl.c:2596:14-31: WARNING: casting value returned by memory allocation function to (SCSIDevicePage0_t *) is useless. ./drivers/message/fusion/mptctl.c:2660:15-32: WARNING: casting value returned by memory allocation function to (SCSIDevicePage3_t *) is useless. Link: https://lore.kernel.org/r/1596014390-18605-1-git-send-email-liheng40@huawei.com Signed-off-by: Li Heng Signed-off-by: Martin K. Petersen --- drivers/message/fusion/mptctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/message') diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 1074b882c57c..24aebad60366 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -2593,7 +2593,7 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg) /* Get the data transfer speeds */ data_sz = ioc->spi_data.sdp0length * 4; - pg0_alloc = (SCSIDevicePage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma); + pg0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma); if (pg0_alloc) { hdr.PageVersion = ioc->spi_data.sdp0version; hdr.PageLength = data_sz; @@ -2657,8 +2657,7 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg) /* Issue the second config page request */ cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; data_sz = (int) cfg.cfghdr.hdr->PageLength * 4; - pg3_alloc = (SCSIDevicePage3_t *) pci_alloc_consistent( - ioc->pcidev, data_sz, &page_dma); + pg3_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma); if (pg3_alloc) { cfg.physAddr = page_dma; cfg.pageAddr = (karg.hdr.channel << 8) | karg.hdr.id; -- cgit v1.2.3 From bef7afbf3bb64443530170c0712060e11bea27e7 Mon Sep 17 00:00:00 2001 From: Jason Yan Date: Thu, 27 Aug 2020 20:59:25 +0800 Subject: scsi: mptscsih: Remove set but not used 'timeleft' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This addresses the following gcc warning with "make W=1": drivers/message/fusion/mptscsih.c: In function ‘mptscsih_IssueTaskMgmt’: drivers/message/fusion/mptscsih.c:1519:17: warning: variable ‘timeleft’ set but not used [-Wunused-but-set-variable] 1519 | unsigned long timeleft; | ^~~~~~~~ Link: https://lore.kernel.org/r/20200827125925.428357-1-yanaijie@huawei.com Reported-by: Hulk Robot Signed-off-by: Jason Yan Signed-off-by: Martin K. Petersen --- drivers/message/fusion/mptscsih.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/message') diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 1491561d2e5c..f10831bd57e2 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1516,7 +1516,6 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun, int ii; int retval; MPT_ADAPTER *ioc = hd->ioc; - unsigned long timeleft; u8 issue_hard_reset; u32 ioc_raw_state; unsigned long time_count; @@ -1614,7 +1613,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun, } } - timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, + wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, timeout*HZ); if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { retval = FAILED; -- cgit v1.2.3