Skip to contentSkip to conversation

arm: remove cast for kzalloc return value

PATCH Applied Zhang Yanfei 7 participants 26 messages Mar 12, 2013

Subsystems (21)
lore
Share & tools
lore
#0 lore raw

PATCH 1/18 arm: remove cast for kzalloc return value

remove cast for kzalloc return value.

Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/kernel/topology.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/kernel/topology.c +1 -1
index 79282eb..f10316b 100644
@@ -100,7 +100,7 @@ static void __init parse_dt_topology(void)
 	int alloc_size, cpu = 0;
 
 	alloc_size = nr_cpu_ids * sizeof(struct cpu_capacity);
-	cpu_capacity = (struct cpu_capacity *)kzalloc(alloc_size, GFP_NOWAIT);
+	cpu_capacity = kzalloc(alloc_size, GFP_NOWAIT);
 
 	while ((cn = of_find_node_by_type(cn, "cpu"))) {
 		const u32 *rate, *reg;
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/18 ia64: remove cast for kmalloc return value

remove cast for kmalloc return value.

---
 arch/ia64/kernel/mca_drv.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/ia64/kernel/mca_drv.c +1 -1
index 9392e02..94f8bf7 100644
@@ -349,7 +349,7 @@ init_record_index_pools(void)
 
 	/* - 3 - */
 	slidx_pool.max_idx = (rec_max_size/sect_min_size) * 2 + 1;
-	slidx_pool.buffer = (slidx_list_t *)
+	slidx_pool.buffer  		kmalloc(slidx_pool.max_idx * sizeof(slidx_list_t), GFP_KERNEL);
 
 	return slidx_pool.buffer ? 0 : -ENOMEM;
Signature · 1 line
1.7.1
#2 lore raw

PATCH 3/18 powerpc: remove cast for kmalloc/kzalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc/kzalloc return value.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Andrew Morton <[email protected]>
---
 arch/powerpc/kernel/nvram_64.c |    3 +--
 arch/powerpc/kvm/book3s_pr.c   |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/kernel/nvram_64.c +1 -2
index bec1e93..48fbc2b 100644
@@ -511,8 +511,7 @@ int __init nvram_scan_partitions(void)
 			       "detected: 0-length partition\n");
 			goto out;
 		}
-		tmp_part = (struct nvram_partition *)
-			kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
+		tmp_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
 		err = -ENOMEM;
 		if (!tmp_part) {
 			printk(KERN_ERR "nvram_scan_partitions: kmalloc failed\n");
arch/powerpc/kvm/book3s_pr.c +1 -1
index 5e93438..dbdc15a 100644
@@ -1039,7 +1039,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
 	if (!vcpu_book3s)
 		goto out;
 
-	vcpu_book3s->shadow_vcpu = (struct kvmppc_book3s_shadow_vcpu *)
+	vcpu_book3s->shadow_vcpu =
 		kzalloc(sizeof(*vcpu_book3s->shadow_vcpu), GFP_KERNEL);
 	if (!vcpu_book3s->shadow_vcpu)
 		goto free_vcpu;
Signature · 1 line
1.7.1
#3 lore raw

PATCH 4/18 x86: platform: mrst: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Andrew Morton <[email protected]>
---
 arch/x86/platform/mrst/mrst.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/platform/mrst/mrst.c +1 -2
index e31bcd8..a0a0a43 100644
@@ -356,8 +356,7 @@ static int __init sfi_parse_gpio(struct sfi_table_header *table)
 	num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry);
 	pentry = (struct sfi_gpio_table_entry *)sb->pentry;
 
-	gpio_table = (struct sfi_gpio_table_entry *)
-				kmalloc(num * sizeof(*pentry), GFP_KERNEL);
+	gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
 	if (!gpio_table)
 		return -1;
 	memcpy(gpio_table, pentry, num * sizeof(*pentry));
Signature · 1 line
1.7.1
#5 lore raw

PATCH 5/18 driver: staging: csr: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

Cc Greg Kroah-Hartman <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/staging/csr/drv.c                  |    4 ++--
 drivers/staging/csr/netdev.c               |    2 +-
 drivers/staging/csr/sdio_mmc.c             |    3 +--
 drivers/staging/csr/sme_native.c           |    2 +-
 drivers/staging/csr/unifi_pdu_processing.c |    4 ++--
 5 files changed, 7 insertions(+), 8 deletions(-)
drivers/staging/csr/drv.c +2 -2
index 3bd52fd..5520d65 100644
@@ -1815,7 +1815,7 @@ udi_log_event(ul_client_t *pcli,
     }
 
     /* Allocate log structure plus actual signal. */
-    logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
+    logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
 
     if (logptr == NULL) {
         printk(KERN_ERR
@@ -1890,7 +1890,7 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length)
     }
 
     /* Allocate log structure plus actual signal. */
-    logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + length, GFP_ATOMIC);
+    logptr = kmalloc(sizeof(udi_log_t) + length, GFP_ATOMIC);
     if (logptr == NULL) {
         unifi_error(priv, "Failed to allocate %d bytes for an SME message\n",
                     sizeof(udi_log_t) + length);
drivers/staging/csr/netdev.c +1 -1
index 7dad26f..a0177d9 100644
@@ -2365,7 +2365,7 @@ unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata)
         rx_buffered_packets_t *rx_q_item;
         struct list_head *rx_list;
 
-        rx_q_item = (rx_buffered_packets_t *)kmalloc(sizeof(rx_buffered_packets_t),
+        rx_q_item = kmalloc(sizeof(rx_buffered_packets_t),
                 GFP_KERNEL);
         if (rx_q_item == NULL) {
             unifi_error(priv, "%s: Failed to allocate %d bytes for rx packet record\n",
drivers/staging/csr/sdio_mmc.c +1 -2
index b6a16de..30271d3 100644
@@ -1031,8 +1031,7 @@ uf_glue_sdio_probe(struct sdio_func *func,
            sdio_func_id(func), instance);
 
     /* Allocate context */
-    sdio_ctx = (CsrSdioFunction *)kmalloc(sizeof(CsrSdioFunction),
-                                          GFP_KERNEL);
+    sdio_ctx = kmalloc(sizeof(CsrSdioFunction), GFP_KERNEL);
     if (sdio_ctx == NULL) {
         sdio_release_host(func);
         return -ENOMEM;
drivers/staging/csr/sme_native.c +1 -1
index 525fe1b..ca55249 100644
@@ -273,7 +273,7 @@ sme_native_log_event(ul_client_t *pcli,
     }
 
     /* Allocate log structure plus actual signal. */
-    logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
+    logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
 
     if (logptr == NULL) {
         unifi_error(priv,
drivers/staging/csr/unifi_pdu_processing.c +2 -2
index 95efc36..bf7c00a 100644
@@ -403,7 +403,7 @@ CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata,
 
 
 
-    tx_q_item = (tx_buffered_packets_t *)kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
+    tx_q_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
     if (tx_q_item == NULL) {
         unifi_error(priv,
                 "Failed to allocate %d bytes for tx packet record\n",
@@ -3282,7 +3282,7 @@ void add_to_send_cfm_list(unifi_priv_t * priv,
 {
     tx_buffered_packets_t *send_cfm_list_item = NULL;
 
-    send_cfm_list_item = (tx_buffered_packets_t *) kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
+    send_cfm_list_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
 
     if(send_cfm_list_item == NULL){
         unifi_warning(priv, "%s: Failed to allocate memory for new list item \n");
Signature · 1 line
1.7.1
#6 lore raw

PATCH 6/18 driver: gpu: drm: i915: remove cast for kzalloc return value

In reply to Zhang Yanfei

remove cast for kzalloc return value.

---
 drivers/gpu/drm/i915/intel_sdvo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +1 -1
index d07a8cd..78413ec 100644
@@ -451,7 +451,7 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
 	int i, ret = true;
 
         /* Would be simpler to allocate both in one go ? */        
-	buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL);
+	buf = kzalloc(args_len * 2 + 2, GFP_KERNEL);
 	if (!buf)
 		return false;
 
Signature · 1 line
1.7.1
#7 lore raw

PATCH 7/18 driver: hv: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

Cc "K. Y. Srinivasan" <[email protected]>
Cc Haiyang Zhang <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/hv/hv.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/hv/hv.c +2 -3
index 7311589..ae49237 100644
@@ -289,9 +289,8 @@ void hv_synic_init(void *arg)
 	/* Check the version */
 	rdmsrl(HV_X64_MSR_SVERSION, version);
 
-	hv_context.event_dpc[cpu] = (struct tasklet_struct *)
-					kmalloc(sizeof(struct tasklet_struct),
-						GFP_ATOMIC);
+	hv_context.event_dpc[cpu] = kmalloc(sizeof(struct tasklet_struct),
+					    GFP_ATOMIC);
 	if (hv_context.event_dpc[cpu] == NULL) {
 		pr_err("Unable to allocate event dpc\n");
 		goto cleanup;
Signature · 1 line
1.7.1
#8 lore raw

PATCH 8/18 driver: isdn: capi: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

---
 drivers/isdn/capi/capidrv.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/isdn/capi/capidrv.c +1 -2
index 832bc80..cc9f192 100644
@@ -469,8 +469,7 @@ static int capidrv_add_ack(struct capidrv_ncci *nccip,
 {
 	struct ncci_datahandle_queue *n, **pp;
 
-	n = (struct ncci_datahandle_queue *)
-		kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC);
+	n = kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC);
 	if (!n) {
 		printk(KERN_ERR "capidrv: kmalloc ncci_datahandle failed\n");
 		return -1;
Signature · 1 line
1.7.1
#10 lore raw

PATCH 9/18 driver: isdn: hisax: remove cast for kmalloc/kzalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc/kzalloc return value.

---
 drivers/isdn/hisax/fsm.c    |    2 +-
 drivers/isdn/hisax/hfc_sx.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/isdn/hisax/fsm.c +1 -1
index 1bb2910..c7a9471 100644
@@ -26,7 +26,7 @@ FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
 {
 	int i;
 
-	fsm->jumpmatrix = (FSMFNPTR *)
+	fsm->jumpmatrix =
 		kzalloc(sizeof(FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL);
 	if (!fsm->jumpmatrix)
 		return -ENOMEM;
drivers/isdn/hisax/hfc_sx.c +1 -1
index 90f34ae..dc4574f 100644
@@ -1479,7 +1479,7 @@ int setup_hfcsx(struct IsdnCard *card)
 			release_region(cs->hw.hfcsx.base, 2);
 			return (0);
 		}
-		if (!(cs->hw.hfcsx.extra = (void *)
+		if (!(cs->hw.hfcsx.extra =
 		      kmalloc(sizeof(struct hfcsx_extra), GFP_ATOMIC))) {
 			release_region(cs->hw.hfcsx.base, 2);
 			printk(KERN_WARNING "HFC-SX: unable to allocate memory\n");
Signature · 1 line
1.7.1
#12 lore raw

PATCH 10/18 driver: s390: block: remove cast for kzalloc return value

In reply to Zhang Yanfei

remove cast for kzalloc return value.

Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/s390/block/dasd_devmap.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/s390/block/dasd_devmap.c +1 -2
index c196827..a71bb8a 100644
@@ -410,8 +410,7 @@ dasd_add_busid(const char *bus_id, int features)
 	struct dasd_devmap *devmap, *new, *tmp;
 	int hash;
 
-	new = (struct dasd_devmap *)
-		kzalloc(sizeof(struct dasd_devmap), GFP_KERNEL);
+	new = kzalloc(sizeof(struct dasd_devmap), GFP_KERNEL);
 	if (!new)
 		return ERR_PTR(-ENOMEM);
 	spin_lock(&dasd_devmap_lock);
Signature · 1 line
1.7.1
#14 lore raw

PATCH 11/18 driver: s390: net: remove cast for kzalloc return value

In reply to Zhang Yanfei

remove cast for kzalloc return value.

Cc Ursula Braun <[email protected]>
Cc Frank Blaschka <[email protected]>
Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/s390/net/qeth_core_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/s390/net/qeth_core_main.c +1 -1
index 0d8cdff..754a54f 100644
@@ -316,7 +316,7 @@ static inline int qeth_alloc_cq(struct qeth_card *card)
 
 		card->qdio.no_in_queues = 2;
 
-		card->qdio.out_bufstates = (struct qdio_outbuf_state *)
+		card->qdio.out_bufstates =
 			kzalloc(card->qdio.no_out_queues *
 				QDIO_MAX_BUFFERS_PER_Q *
 				sizeof(struct qdio_outbuf_state), GFP_KERNEL);
Signature · 1 line
1.7.1
#16 lore raw

PATCH 12/18 driver: scsi: remove cast for kmalloc/kzalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc/kzalloc return value.

Cc "James E.J. Bottomley" <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/scsi/hpsa.c           |    3 +--
 drivers/scsi/lpfc/lpfc_init.c |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/hpsa.c +1 -2
index 7f4f790..7a5a002 100644
@@ -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;
drivers/scsi/lpfc/lpfc_init.c +1 -1
index 314b4f6..f9a3b30 100644
@@ -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)
Signature · 1 line
1.7.1
#19 lore raw

PATCH 13/18 driver: tty: serial: remove cast for kzalloc return value

In reply to Zhang Yanfei

remove cast for kzalloc return value.

Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/tty/serial/icom.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/tty/serial/icom.c +1 -2
index bc9e6b0..18ed5ae 100644
@@ -1415,8 +1415,7 @@ static int icom_alloc_adapter(struct icom_adapter
 	struct icom_adapter *cur_adapter_entry;
 	struct list_head *tmp;
 
-	icom_adapter = (struct icom_adapter *)
-	    kzalloc(sizeof(struct icom_adapter), GFP_KERNEL);
+	icom_adapter = kzalloc(sizeof(struct icom_adapter), GFP_KERNEL);
 
 	if (!icom_adapter) {
 		return -ENOMEM;
Signature · 1 line
1.7.1
#20 lore raw

PATCH 14/18 driver: tty: vt: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/tty/vt/consolemap.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/tty/vt/consolemap.c +1 -2
index 248381b..2978ca5 100644
@@ -194,8 +194,7 @@ static void set_inverse_transl(struct vc_data *conp, struct uni_pagedir *p, int
 	q = p->inverse_translations[i];
 
 	if (!q) {
-		q = p->inverse_translations[i] = (unsigned char *) 
-			kmalloc(MAX_GLYPH, GFP_KERNEL);
+		q = p->inverse_translations[i] = kmalloc(MAX_GLYPH, GFP_KERNEL);
 		if (!q) return;
 	}
 	memset(q, 0, MAX_GLYPH);
Signature · 1 line
1.7.1
#21 lore raw

PATCH 15/18 driver: usb: storage: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

Cc Matthew Dharm <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Andrew Morton <[email protected]>
---
 drivers/usb/storage/isd200.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/usb/storage/isd200.c +1 -2
index ecea478..06a3d22 100644
@@ -1457,8 +1457,7 @@ static int isd200_init_info(struct us_data *us)
 		retStatus = ISD200_ERROR;
 	else {
 		info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
-		info->RegsBuf = (unsigned char *)
-				kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
+		info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
 		info->srb.sense_buffer =
 				kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
 		if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) {
Signature · 1 line
1.7.1
#22 lore raw

PATCH 16/18 fs: befs: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

---
 fs/befs/btree.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
fs/befs/btree.c +1 -2
index a66c9b1..74e397d 100644
@@ -436,8 +436,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
 		goto error;
 	}
 
-	if ((this_node = (befs_btree_node *)
-	     kmalloc(sizeof (befs_btree_node), GFP_NOFS)) == NULL) {
+	if ((this_node = kmalloc(sizeof (befs_btree_node), GFP_NOFS)) == NULL) {
 		befs_error(sb, "befs_btree_read() failed to allocate %u "
 			   "bytes of memory", sizeof (befs_btree_node));
 		goto error;
Signature · 1 line
1.7.1
#23 lore raw

PATCH 17/18 fs: ufs: remove cast for kmalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc return value.

Cc Evgeniy Dushistov <[email protected]>
Cc Andrew Morton <[email protected]>
---
 fs/ufs/util.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
fs/ufs/util.c +1 -2
index 95425b5..b6c2f94 100644
@@ -26,8 +26,7 @@ struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi,
 	count = size >> uspi->s_fshift;
 	if (count > UFS_MAXFRAG)
 		return NULL;
-	ubh = (struct ufs_buffer_head *)
-		kmalloc (sizeof (struct ufs_buffer_head), GFP_NOFS);
+	ubh = kmalloc (sizeof (struct ufs_buffer_head), GFP_NOFS);
 	if (!ubh)
 		return NULL;
 	ubh->fragment = fragment;
Signature · 1 line
1.7.1
#24 lore raw

PATCH 18/18 net: sctp: remove cast for kmalloc/kzalloc return value

In reply to Zhang Yanfei

remove cast for kmalloc/kzalloc return value.

Cc Vlad Yasevich <[email protected]>
Cc Sridhar Samudrala <[email protected]>
Cc Neil Horman <[email protected]>
Cc Andrew Morton <[email protected]>
---
 include/net/sctp/sctp.h |    2 +-
 net/sctp/protocol.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/sctp/sctp.h +1 -1
index df85a0c..cd89510 100644
@@ -576,7 +576,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
 #define WORD_ROUND(s) (((s)+3)&~3)
 
 /* Make a new instance of type.  */
-#define t_new(type, flags)	(type *)kzalloc(sizeof(type), flags)
+#define t_new(type, flags)	kzalloc(sizeof(type), flags)
 
 /* Compare two timevals.  */
 #define tv_lt(s, t) \
net/sctp/protocol.c +1 -1
index 1c2e46c..eaee00c 100644
@@ -1403,7 +1403,7 @@ SCTP_STATIC __init int sctp_init(void)
 
 	/* Allocate and initialize the endpoint hash table.  */
 	sctp_ep_hashsize = 64;
-	sctp_ep_hashtable = (struct sctp_hashbucket *)
+	sctp_ep_hashtable  		kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
 	if (!sctp_ep_hashtable) {
 		pr_err("Failed endpoint_hash alloc\n");
Signature · 1 line
1.7.1
#13 lore raw

Re: [PATCH 10/18] driver: s390: block: remove cast for kzalloc return value

In reply to Zhang Yanfei
Quoted 1 line · Zhang Yanfei

remove cast for kzalloc return value.

[...]

drivers/s390/block/dasd_devmap.c dasd_add_busid(const char *bus_id, int features) · line 413

Quoted 11 lines
drivers/s390/block/dasd_devmap.c +1 -2
index c196827..a71bb8a 100644
@@ -410,8 +410,7 @@ dasd_add_busid(const char *bus_id, int features)
 	struct dasd_devmap *devmap, *new, *tmp;
 	int hash;
 
-	new = (struct dasd_devmap *)
-		kzalloc(sizeof(struct dasd_devmap), GFP_KERNEL);
+	new = kzalloc(sizeof(struct dasd_devmap), GFP_KERNEL);

Applied, thanks.

#15 lore raw

Re: [PATCH 11/18] driver: s390: net: remove cast for kzalloc return value

In reply to Zhang Yanfei
Quoted 11 lines · Zhang Yanfei

remove cast for kzalloc return value.

 drivers/s390/net/qeth_core_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/s390/net/qeth_core_main.c +0 -0
index 0d8cdff..754a54f 100644

drivers/s390/net/qeth_core_main.c static inline int qeth_alloc_cq(struct qeth_card *card) · line 319

Quoted 5 lines
drivers/s390/net/qeth_core_main.c +1 -1
@@ -316,7 +316,7 @@ static inline int qeth_alloc_cq(struct qeth_card *card)
 
 		card->qdio.no_in_queues = 2;
 
-		card->qdio.out_bufstates = (struct qdio_outbuf_state *)
+		card->qdio.out_bufstates =

Applied, thanks.

#4 lore raw

[tip:x86/platform] x86/platform/intel/mrst: Remove cast for kmalloc() return value

In reply to Zhang Yanfei
x86/platform/intel/mrst: Remove cast for kmalloc() return value
Commit-ID:  ad0304cfd90f46bfcae3a6cd2b69067741541730
Gitweb:     http://git.kernel.org/tip/ad0304cfd90f46bfcae3a6cd2b69067741541730
Author:     Zhang Yanfei <[email protected]>
AuthorDate: Tue, 12 Mar 2013 12:58:02 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 12 Mar 2013 09:10:20 +0100

x86/platform/intel/mrst: Remove cast for kmalloc() return value

---
 arch/x86/platform/mrst/mrst.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/platform/mrst/mrst.c +1 -2
index e31bcd8..a0a0a43 100644
@@ -356,8 +356,7 @@ static int __init sfi_parse_gpio(struct sfi_table_header *table)
 	num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry);
 	pentry = (struct sfi_gpio_table_entry *)sb->pentry;
 
-	gpio_table = (struct sfi_gpio_table_entry *)
-				kmalloc(num * sizeof(*pentry), GFP_KERNEL);
+	gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
 	if (!gpio_table)
 		return -1;
 	memcpy(gpio_table, pentry, num * sizeof(*pentry));
maintainer
#17 lore raw

Re: [PATCH 12/18] driver: scsi: remove cast for kmalloc/kzalloc return value

In reply to Zhang Yanfei
Quoted 1 line · Zhang Yanfei

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

Acked-by on v1 18/18
#25 lore raw

Re: [PATCH 18/18] net: sctp: remove cast for kmalloc/kzalloc return value

In reply to Zhang Yanfei
Quoted 46 lines · Zhang Yanfei

remove cast for kmalloc/kzalloc return value.

Cc Vlad Yasevich <[email protected]>
Cc Sridhar Samudrala <[email protected]>
Cc Neil Horman <[email protected]>
Cc Andrew Morton <[email protected]>
---
 include/net/sctp/sctp.h |    2 +-
 net/sctp/protocol.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/sctp/sctp.h +1 -1
index df85a0c..cd89510 100644
@@ -576,7 +576,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
 #define WORD_ROUND(s) (((s)+3)&~3)
 
 /* Make a new instance of type.  */
-#define t_new(type, flags)	(type *)kzalloc(sizeof(type), flags)
+#define t_new(type, flags)	kzalloc(sizeof(type), flags)
 
 /* Compare two timevals.  */
 #define tv_lt(s, t) \
net/sctp/protocol.c +1 -1
index 1c2e46c..eaee00c 100644
@@ -1403,7 +1403,7 @@ SCTP_STATIC __init int sctp_init(void)
 
 	/* Allocate and initialize the endpoint hash table.  */
 	sctp_ep_hashsize = 64;
-	sctp_ep_hashtable = (struct sctp_hashbucket *)
+	sctp_ep_hashtable >  		kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
 	if (!sctp_ep_hashtable) {
 		pr_err("Failed endpoint_hash alloc\n");
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#18 lore raw

Re: [PATCH 12/18] driver: scsi: remove cast for kmalloc/kzalloc return value

In reply to James Bottomley
Quoted 7 lines · James Bottomley
Quoted 1 line · Zhang Yanfei

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?