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


Groups > linux.kernel > #1500414

[PATCH] scsi: hpsa: remove unneeded void pointer cast

From Javier Martinez Canillas <javier@osg.samsung.com>
Newsgroups linux.kernel
Subject [PATCH] scsi: hpsa: remove unneeded void pointer cast
Date 2016-10-13 18:20 +0200
Message-ID <srQTE-5MC-17@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


It's not necessary to cast the result of kmalloc, since void pointers are
promoted to any other type. This also fixes following coccinelle warning:

casting value returned by memory allocation function to (BIG_IOCTL_Command_struct *) is useless.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/scsi/hpsa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index d007ec18179a..4e82b692298e 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6657,8 +6657,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 		return -EINVAL;
 	if (!capable(CAP_SYS_RAWIO))
 		return -EPERM;
-	ioc = (BIG_IOCTL_Command_struct *)
-	    kmalloc(sizeof(*ioc), GFP_KERNEL);
+	ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
 	if (!ioc) {
 		status = -ENOMEM;
 		goto cleanup1;
-- 
2.7.4

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


Thread

[PATCH] scsi: hpsa: remove unneeded void pointer cast Javier Martinez Canillas <javier@osg.samsung.com> - 2016-10-13 18:20 +0200
  Re: [PATCH] scsi: hpsa: remove unneeded void pointer cast Don Brace <brace77070@gmail.com> - 2016-10-13 22:50 +0200
  Re: [PATCH] scsi: hpsa: remove unneeded void pointer cast "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-10-14 22:30 +0200

csiph-web