public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 12/18] driver: scsi: remove cast for kmalloc/kzalloc return value
       [not found] <513EB23D.7020303@cn.fujitsu.com>
@ 2013-03-12  5:25 ` Zhang Yanfei
  2013-03-12  9:27   ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Yanfei @ 2013-03-12  5:25 UTC (permalink / raw)
  To: James E.J. Bottomley, Andrew Morton
  Cc: linux-scsi, linux-kernel@vger.kernel.org

remove cast for kmalloc/kzalloc return value.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/hpsa.c           |    3 +--
 drivers/scsi/lpfc/lpfc_init.c |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 7f4f790..7a5a002 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3071,8 +3071,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;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 314b4f6..f9a3b30 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4674,7 +4674,7 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
 	}
 
 	if (!phba->sli.ring)
-		phba->sli.ring = (struct lpfc_sli_ring *)
+		phba->sli.ring =
 			kzalloc(LPFC_SLI3_MAX_RING *
 			sizeof(struct lpfc_sli_ring), GFP_KERNEL);
 	if (!phba->sli.ring)
-- 
1.7.1

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

* Re: [PATCH 12/18] driver: scsi: remove cast for kmalloc/kzalloc return value
  2013-03-12  5:25 ` [PATCH 12/18] driver: scsi: remove cast for kmalloc/kzalloc return value Zhang Yanfei
@ 2013-03-12  9:27   ` James Bottomley
  2013-03-12 16:32     ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2013-03-12  9:27 UTC (permalink / raw)
  To: Zhang Yanfei; +Cc: Andrew Morton, linux-scsi, linux-kernel@vger.kernel.org

On Tue, 2013-03-12 at 13:25 +0800, Zhang Yanfei wrote:
> remove cast for kmalloc/kzalloc return value.

I've got to ask why?  Just because void * can be assigned to any pointer
doesn't mean we should religiously eliminate all casts of void *.  If
the driver writer believes there's value making sure of the pointer
type, I'm happy to keep the cast.

James

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

* Re: [PATCH 12/18] driver: scsi: remove cast for kmalloc/kzalloc return value
  2013-03-12  9:27   ` James Bottomley
@ 2013-03-12 16:32     ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2013-03-12 16:32 UTC (permalink / raw)
  To: James Bottomley
  Cc: Zhang Yanfei, Andrew Morton, linux-scsi,
	linux-kernel@vger.kernel.org

On Tue, 2013-03-12 at 09:27 +0000, James Bottomley wrote:
> On Tue, 2013-03-12 at 13:25 +0800, Zhang Yanfei wrote:
> > remove cast for kmalloc/kzalloc return value.
> 
> I've got to ask why?  Just because void * can be assigned to any pointer
> doesn't mean we should religiously eliminate all casts of void *.  If
> the driver writer believes there's value making sure of the pointer
> type, I'm happy to keep the cast.

This view is why scsi has many different styles
instead of a more consistent kernel style.

For the cciss/hpsa example shown:

Do you suggest indirecting structs with typedefs like
BIG_IOCTL_Command_struct is a good thing as well
because the driver writer thinks it so?

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

end of thread, other threads:[~2013-03-12 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <513EB23D.7020303@cn.fujitsu.com>
2013-03-12  5:25 ` [PATCH 12/18] driver: scsi: remove cast for kmalloc/kzalloc return value Zhang Yanfei
2013-03-12  9:27   ` James Bottomley
2013-03-12 16:32     ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox