linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: hpsa: remove unneeded void pointer cast
@ 2016-10-13 16:10 Javier Martinez Canillas
  2016-10-13 20:45 ` Don Brace
  2016-10-14 20:23 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2016-10-13 16:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, iss_storagedev, linux-scsi,
	James E.J. Bottomley, esc.storagedev, Don Brace,
	Martin K. Petersen

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: hpsa: remove unneeded void pointer cast
  2016-10-13 16:10 [PATCH] scsi: hpsa: remove unneeded void pointer cast Javier Martinez Canillas
@ 2016-10-13 20:45 ` Don Brace
  2016-10-14 20:23 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Don Brace @ 2016-10-13 20:45 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: iss_storagedev, linux-scsi, James E.J. Bottomley, esc.storagedev,
	Martin K. Petersen, linux-kernel

On 10/13/2016 11:10 AM, Javier Martinez Canillas wrote:
> 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;
Acked-by: Don Brace <don.brace@microsemi.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: hpsa: remove unneeded void pointer cast
  2016-10-13 16:10 [PATCH] scsi: hpsa: remove unneeded void pointer cast Javier Martinez Canillas
  2016-10-13 20:45 ` Don Brace
@ 2016-10-14 20:23 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-10-14 20:23 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, iss_storagedev, linux-scsi, James E.J. Bottomley,
	esc.storagedev, Don Brace, Martin K. Petersen

>>>>> "Javier" == Javier Martinez Canillas <javier@osg.samsung.com> writes:

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

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

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-14 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-13 16:10 [PATCH] scsi: hpsa: remove unneeded void pointer cast Javier Martinez Canillas
2016-10-13 20:45 ` Don Brace
2016-10-14 20:23 ` Martin K. Petersen

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).