2013-03-12 04:44:14

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 01/18] arm: remove cast for kzalloc return value

remove cast for kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
---
arch/arm/kernel/topology.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 79282eb..f10316b 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -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;
--
1.7.1


2013-03-12 04:48:45

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 02/18] ia64: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
---
arch/ia64/kernel/mca_drv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index 9392e02..94f8bf7 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -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;
--
1.7.1

2013-03-12 04:55:42

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 03/18] powerpc: remove cast for kmalloc/kzalloc return value

remove cast for kmalloc/kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
---
arch/powerpc/kernel/nvram_64.c | 3 +--
arch/powerpc/kvm/book3s_pr.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index bec1e93..48fbc2b 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -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");
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 5e93438..dbdc15a 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -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;
--
1.7.1

2013-03-12 04:59:39

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 04/18] x86: platform: mrst: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: "[email protected]" <[email protected]>
---
arch/x86/platform/mrst/mrst.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index e31bcd8..a0a0a43 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -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));
--
1.7.1

2013-03-12 05:05:12

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 05/18] driver: staging: csr: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [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(-)

diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c
index 3bd52fd..5520d65 100644
--- a/drivers/staging/csr/drv.c
+++ b/drivers/staging/csr/drv.c
@@ -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);
diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c
index 7dad26f..a0177d9 100644
--- a/drivers/staging/csr/netdev.c
+++ b/drivers/staging/csr/netdev.c
@@ -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",
diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c
index b6a16de..30271d3 100644
--- a/drivers/staging/csr/sdio_mmc.c
+++ b/drivers/staging/csr/sdio_mmc.c
@@ -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;
diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c
index 525fe1b..ca55249 100644
--- a/drivers/staging/csr/sme_native.c
+++ b/drivers/staging/csr/sme_native.c
@@ -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,
diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c
index 95efc36..bf7c00a 100644
--- a/drivers/staging/csr/unifi_pdu_processing.c
+++ b/drivers/staging/csr/unifi_pdu_processing.c
@@ -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");
--
1.7.1

2013-03-12 05:09:13

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 06/18] driver: gpu: drm: i915: remove cast for kzalloc return value

remove cast for kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: David Airlie <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/i915/intel_sdvo.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index d07a8cd..78413ec 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -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;

--
1.7.1

2013-03-12 05:12:16

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 07/18] driver: hv: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: "K. Y. Srinivasan" <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
---
drivers/hv/hv.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 7311589..ae49237 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -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;
--
1.7.1

2013-03-12 05:15:24

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 08/18] driver: isdn: capi: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Karsten Keil <[email protected]>
Cc: [email protected]
---
drivers/isdn/capi/capidrv.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 832bc80..cc9f192 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -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;
--
1.7.1

2013-03-12 05:17:25

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 09/18] driver: isdn: hisax: remove cast for kmalloc/kzalloc return value

remove cast for kmalloc/kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Karsten Keil <[email protected]>
Cc: [email protected]
---
drivers/isdn/hisax/fsm.c | 2 +-
drivers/isdn/hisax/hfc_sx.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/isdn/hisax/fsm.c b/drivers/isdn/hisax/fsm.c
index 1bb2910..c7a9471 100644
--- a/drivers/isdn/hisax/fsm.c
+++ b/drivers/isdn/hisax/fsm.c
@@ -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;
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index 90f34ae..dc4574f 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -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");
--
1.7.1

2013-03-12 05:20:22

by Zhang Yanfei

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

remove cast for kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
---
drivers/s390/block/dasd_devmap.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index c196827..a71bb8a 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -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);
--
1.7.1

2013-03-12 05:24:16

by Zhang Yanfei

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

remove cast for kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
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]>
Cc: [email protected]
Cc: [email protected]
---
drivers/s390/net/qeth_core_main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 0d8cdff..754a54f 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -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);
--
1.7.1

2013-03-12 05:26:39

by Zhang Yanfei

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

remove cast for kmalloc/kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
---
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

2013-03-12 05:29:05

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 13/18] driver: tty: serial: remove cast for kzalloc return value

remove cast for kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
---
drivers/tty/serial/icom.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index bc9e6b0..18ed5ae 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -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;
--
1.7.1

2013-03-12 05:31:09

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 14/18] driver: tty: vt: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
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(-)

diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index 248381b..2978ca5 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -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);
--
1.7.1

2013-03-12 05:35:07

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 15/18] driver: usb: storage: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Matthew Dharm <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/usb/storage/isd200.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index ecea478..06a3d22 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -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) {
--
1.7.1

2013-03-12 05:36:44

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 16/18] fs: befs: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Andrew Morton <[email protected]>
---
fs/befs/btree.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index a66c9b1..74e397d 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -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;
--
1.7.1

2013-03-12 05:38:40

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 17/18] fs: ufs: remove cast for kmalloc return value

remove cast for kmalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Evgeniy Dushistov <[email protected]>
Cc: Andrew Morton <[email protected]>
---
fs/ufs/util.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index 95425b5..b6c2f94 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -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;
--
1.7.1

2013-03-12 05:41:23

by Zhang Yanfei

[permalink] [raw]
Subject: [PATCH 18/18] net: sctp: remove cast for kmalloc/kzalloc return value

remove cast for kmalloc/kzalloc return value.

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Vlad Yasevich <[email protected]>
Cc: Sridhar Samudrala <[email protected]>
Cc: Neil Horman <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
---
include/net/sctp/sctp.h | 2 +-
net/sctp/protocol.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index df85a0c..cd89510 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -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) \
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 1c2e46c..eaee00c 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -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");
--
1.7.1

2013-03-12 07:22:55

by Heiko Carstens

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

On Tue, Mar 12, 2013 at 01:18:47PM +0800, Zhang Yanfei wrote:
> remove cast for kzalloc return value.

[...]
> diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
> index c196827..a71bb8a 100644
> --- a/drivers/s390/block/dasd_devmap.c
> +++ b/drivers/s390/block/dasd_devmap.c
> @@ -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.

2013-03-12 07:25:29

by Heiko Carstens

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

On Tue, Mar 12, 2013 at 01:22:40PM +0800, Zhang Yanfei wrote:
> remove cast for kzalloc return value.
>
> Signed-off-by: Zhang Yanfei <[email protected]>
> drivers/s390/net/qeth_core_main.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
> index 0d8cdff..754a54f 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -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.

Subject: [tip:x86/platform] 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

Signed-off-by: Zhang Yanfei <[email protected]>
Cc: Andrew Morton <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/platform/mrst/mrst.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index e31bcd8..a0a0a43 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -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));

2013-03-12 09:28:14

by James Bottomley

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

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

2013-03-12 11:36:21

by Neil Horman

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

On Tue, Mar 12, 2013 at 01:39:47PM +0800, Zhang Yanfei wrote:
> remove cast for kmalloc/kzalloc return value.
>
> Signed-off-by: Zhang Yanfei <[email protected]>
> Cc: Vlad Yasevich <[email protected]>
> Cc: Sridhar Samudrala <[email protected]>
> Cc: Neil Horman <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: [email protected]
> ---
> include/net/sctp/sctp.h | 2 +-
> net/sctp/protocol.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
> index df85a0c..cd89510 100644
> --- a/include/net/sctp/sctp.h
> +++ b/include/net/sctp/sctp.h
> @@ -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) \
> diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> index 1c2e46c..eaee00c 100644
> --- a/net/sctp/protocol.c
> +++ b/net/sctp/protocol.c
> @@ -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");
> --
> 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
>
Acked-by: Neil Horman <[email protected]>

2013-03-12 15:41:24

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 08/18] driver: isdn: capi: remove cast for kmalloc return value

From: Zhang Yanfei <[email protected]>
Date: Tue, 12 Mar 2013 13:13:47 +0800

> remove cast for kmalloc return value.
>
> Signed-off-by: Zhang Yanfei <[email protected]>

Applied.

2013-03-12 15:41:31

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 09/18] driver: isdn: hisax: remove cast for kmalloc/kzalloc return value

From: Zhang Yanfei <[email protected]>
Date: Tue, 12 Mar 2013 13:15:49 +0800

> remove cast for kmalloc/kzalloc return value.
>
> Signed-off-by: Zhang Yanfei <[email protected]>

Applied.

2013-03-12 16:32:55

by Joe Perches

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

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?