* [PATCH -next] scsi: Remove unneeded cast from memory allocation
@ 2020-07-29 9:19 Li Heng
2020-09-09 2:17 ` Martin K. Petersen
0 siblings, 1 reply; 3+ messages in thread
From: Li Heng @ 2020-07-29 9:19 UTC (permalink / raw)
To: sathya.prakash, sreekanth.reddy, suganath-prabu.subramani
Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel
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.
Signed-off-by: Li Heng <liheng40@huawei.com>
---
drivers/message/fusion/mptctl.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 1074b88..dbf5255 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -2455,7 +2455,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
}
}
- /*
+ /*
* Gather ISTWI(Industry Standard Two Wire Interface) Data
*/
if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] scsi: Remove unneeded cast from memory allocation
2020-07-29 9:19 [PATCH -next] scsi: Remove unneeded cast from memory allocation Li Heng
@ 2020-09-09 2:17 ` Martin K. Petersen
0 siblings, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2020-09-09 2:17 UTC (permalink / raw)
To: sathya.prakash, suganath-prabu.subramani, Li Heng, sreekanth.reddy
Cc: Martin K . Petersen, MPT-FusionLinux.pdl, linux-scsi, linux-kernel
On Wed, 29 Jul 2020 17:19:50 +0800, Li Heng wrote:
> 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.
Applied to 5.10/scsi-queue, thanks!
[1/1] scsi: mptctl: Remove unneeded cast from memory allocation
https://git.kernel.org/mkp/scsi/c/8fee79ed8ea2
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH -next] scsi: Remove unneeded cast from memory allocation
@ 2020-07-29 9:19 Li Heng
0 siblings, 0 replies; 3+ messages in thread
From: Li Heng @ 2020-07-29 9:19 UTC (permalink / raw)
To: sathya.prakash, sreekanth.reddy, suganath-prabu.subramani
Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel
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.
Signed-off-by: Li Heng <liheng40@huawei.com>
---
drivers/message/fusion/mptfc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 4314a33..34ca9af 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 @@ mptfc_GetFcPortPage1(MPT_ADAPTER *ioc, int portnum)
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)
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-09 2:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 9:19 [PATCH -next] scsi: Remove unneeded cast from memory allocation Li Heng
2020-09-09 2:17 ` Martin K. Petersen
-- strict thread matches above, loose matches on Subject: below --
2020-07-29 9:19 Li Heng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).