Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <liheng40@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Li Heng and committed by
Martin K. Petersen
33fff97c 460d74a0

+2 -4
+2 -4
drivers/message/fusion/mptfc.c
··· 763 763 764 764 data_sz = hdr.PageLength * 4; 765 765 rc = -ENOMEM; 766 - ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma); 766 + ppage0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma); 767 767 if (ppage0_alloc) { 768 768 769 769 try_again: ··· 904 904 if (data_sz < sizeof(FCPortPage1_t)) 905 905 data_sz = sizeof(FCPortPage1_t); 906 906 907 - page1_alloc = (FCPortPage1_t *) pci_alloc_consistent(ioc->pcidev, 907 + page1_alloc = pci_alloc_consistent(ioc->pcidev, 908 908 data_sz, 909 909 &page1_dma); 910 910 if (!page1_alloc) ··· 921 921 goto start_over; 922 922 } 923 923 } 924 - 925 - memset(page1_alloc,0,data_sz); 926 924 927 925 cfg.physAddr = page1_dma; 928 926 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;