Skip to content

Commit 8e5e952

Browse files
jjuhlIngo Molnar
authored andcommitted
x86: Remove unnecessary casts of void ptr returning alloc function return values
The [vk][cmz]alloc(_node) family of functions return void pointers which it's completely unnecessary/pointless to cast to other pointer types since that happens implicitly. This patch removes such casts from arch/x86. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Cc: trivial@kernel.org Cc: amd64-microcode@amd64.org Cc: Andreas Herrmann <andreas.herrmann3@amd.com> LKML-Reference: <alpine.LNX.2.00.1011082310220.23697@swampdragon.chaosbits.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 0059b24 commit 8e5e952

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎arch/x86/kernel/microcode_amd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int install_equiv_cpu_table(const u8 *buf)
212212
return 0;
213213
}
214214

215-
equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
215+
equiv_cpu_table = vmalloc(size);
216216
if (!equiv_cpu_table) {
217217
pr_err("failed to allocate equivalent CPU table\n");
218218
return 0;

‎arch/x86/platform/uv/tlb_uv.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,8 +1343,8 @@ uv_activation_descriptor_init(int node, int pnode)
13431343
* each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
13441344
* per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
13451345
*/
1346-
bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
1347-
UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
1346+
bau_desc = kmalloc_node(sizeof(struct bau_desc) * UV_ADP_SIZE
1347+
* UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
13481348
BUG_ON(!bau_desc);
13491349

13501350
pa = uv_gpa(bau_desc); /* need the real nasid*/
@@ -1402,9 +1402,9 @@ uv_payload_queue_init(int node, int pnode)
14021402
struct bau_payload_queue_entry *pqp_malloc;
14031403
struct bau_control *bcp;
14041404

1405-
pqp = (struct bau_payload_queue_entry *) kmalloc_node(
1406-
(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
1407-
GFP_KERNEL, node);
1405+
pqp = kmalloc_node((DEST_Q_SIZE + 1)
1406+
* sizeof(struct bau_payload_queue_entry),
1407+
GFP_KERNEL, node);
14081408
BUG_ON(!pqp);
14091409
pqp_malloc = pqp;
14101410

@@ -1520,8 +1520,7 @@ static void __init uv_init_per_cpu(int nuvhubs)
15201520

15211521
timeout_us = calculate_destination_timeout();
15221522

1523-
uvhub_descs = (struct uvhub_desc *)
1524-
kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
1523+
uvhub_descs = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
15251524
memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
15261525
uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL);
15271526
for_each_present_cpu(cpu) {

0 commit comments

Comments
 (0)