Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1255172

[PATCH] block: remove useless casting value returned by kmalloc to structure

From Punit Vara <punitvara@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] block: remove useless casting value returned by kmalloc to structure
Date 2015-10-24 14:20 +0200
Message-ID <qn5XI-8si-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


This is the patch to the cciss_scsi.c file that resolves following warning
reported by coccicheck:

WARNING: casting value returned by memory allocation function to (struct
cciss_scsi_adapter_data_t *) is useless.

Signed-off-by: Punit Vara <punitvara@gmail.com>
---
 drivers/block/cciss_scsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 1537302..4c27032 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -703,8 +703,7 @@ cciss_scsi_setup(ctlr_info_t *h)
 	struct cciss_scsi_adapter_data_t * shba;
 
 	ccissscsi[h->ctlr].ndevices = 0;
-	shba = (struct cciss_scsi_adapter_data_t *)
-		kmalloc(sizeof(*shba), GFP_KERNEL);	
+	shba = kmalloc(sizeof(*shba), GFP_KERNEL);
 	if (shba == NULL)
 		return;
 	shba->scsi_host = NULL;
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] block: remove useless casting value returned by kmalloc to structure Punit Vara <punitvara@gmail.com> - 2015-10-24 14:20 +0200
  Re: [PATCH] block: remove useless casting value returned by kmalloc to structure "Matthew R. Ochs" <mrochs@linux.vnet.ibm.com> - 2015-10-25 04:30 +0100

csiph-web