mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
Convert more 'alloc_obj' cases to default GFP_KERNEL arguments
This converts some of the visually simpler cases that have been split over multiple lines. I only did the ones that are easy to verify the resulting diff by having just that final GFP_KERNEL argument on the next line. Somebody should probably do a proper coccinelle script for this, but for me the trivial script actually resulted in an assertion failure in the middle of the script. I probably had made it a bit _too_ trivial. So after fighting that far a while I decided to just do some of the syntactically simpler cases with variations of the previous 'sed' scripts. The more syntactically complex multi-line cases would mostly really want whitespace cleanup anyway. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -260,8 +260,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block)
|
||||
switch (acp_machine_id) {
|
||||
case ST_JADEITE:
|
||||
{
|
||||
adev->acp.acp_cell = kzalloc_objs(struct mfd_cell, 2,
|
||||
GFP_KERNEL);
|
||||
adev->acp.acp_cell = kzalloc_objs(struct mfd_cell, 2);
|
||||
if (!adev->acp.acp_cell) {
|
||||
r = -ENOMEM;
|
||||
goto failure;
|
||||
@@ -273,8 +272,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block)
|
||||
goto failure;
|
||||
}
|
||||
|
||||
i2s_pdata = kzalloc_objs(struct i2s_platform_data, 1,
|
||||
GFP_KERNEL);
|
||||
i2s_pdata = kzalloc_objs(struct i2s_platform_data, 1);
|
||||
if (!i2s_pdata) {
|
||||
r = -ENOMEM;
|
||||
goto failure;
|
||||
@@ -325,8 +323,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
adev->acp.acp_cell = kzalloc_objs(struct mfd_cell, ACP_DEVS,
|
||||
GFP_KERNEL);
|
||||
adev->acp.acp_cell = kzalloc_objs(struct mfd_cell, ACP_DEVS);
|
||||
|
||||
if (!adev->acp.acp_cell) {
|
||||
r = -ENOMEM;
|
||||
@@ -339,8 +336,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block)
|
||||
goto failure;
|
||||
}
|
||||
|
||||
i2s_pdata = kzalloc_objs(struct i2s_platform_data, 3,
|
||||
GFP_KERNEL);
|
||||
i2s_pdata = kzalloc_objs(struct i2s_platform_data, 3);
|
||||
if (!i2s_pdata) {
|
||||
r = -ENOMEM;
|
||||
goto failure;
|
||||
|
||||
@@ -399,8 +399,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
|
||||
|
||||
struct cgs_device *amdgpu_cgs_create_device(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_cgs_device *cgs_device = kmalloc_obj(*cgs_device,
|
||||
GFP_KERNEL);
|
||||
struct amdgpu_cgs_device *cgs_device = kmalloc_obj(*cgs_device);
|
||||
|
||||
if (!cgs_device) {
|
||||
drm_err(adev_to_drm(adev), "Couldn't allocate CGS device structure\n");
|
||||
|
||||
@@ -1673,8 +1673,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
if (is_dp_bridge) {
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig,
|
||||
GFP_KERNEL);
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig);
|
||||
if (!amdgpu_dig_connector)
|
||||
goto failed;
|
||||
amdgpu_connector->con_priv = amdgpu_dig_connector;
|
||||
@@ -1829,8 +1828,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_DVII:
|
||||
case DRM_MODE_CONNECTOR_DVID:
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig,
|
||||
GFP_KERNEL);
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig);
|
||||
if (!amdgpu_dig_connector)
|
||||
goto failed;
|
||||
amdgpu_connector->con_priv = amdgpu_dig_connector;
|
||||
@@ -1887,8 +1885,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_HDMIA:
|
||||
case DRM_MODE_CONNECTOR_HDMIB:
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig,
|
||||
GFP_KERNEL);
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig);
|
||||
if (!amdgpu_dig_connector)
|
||||
goto failed;
|
||||
amdgpu_connector->con_priv = amdgpu_dig_connector;
|
||||
@@ -1937,8 +1934,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
|
||||
connector->doublescan_allowed = false;
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_DisplayPort:
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig,
|
||||
GFP_KERNEL);
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig);
|
||||
if (!amdgpu_dig_connector)
|
||||
goto failed;
|
||||
amdgpu_connector->con_priv = amdgpu_dig_connector;
|
||||
@@ -1987,8 +1983,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
|
||||
connector->doublescan_allowed = false;
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_eDP:
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig,
|
||||
GFP_KERNEL);
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig);
|
||||
if (!amdgpu_dig_connector)
|
||||
goto failed;
|
||||
amdgpu_connector->con_priv = amdgpu_dig_connector;
|
||||
@@ -2015,8 +2010,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
|
||||
connector->doublescan_allowed = false;
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_LVDS:
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig,
|
||||
GFP_KERNEL);
|
||||
amdgpu_dig_connector = kzalloc_obj(struct amdgpu_connector_atom_dig);
|
||||
if (!amdgpu_dig_connector)
|
||||
goto failed;
|
||||
amdgpu_connector->con_priv = amdgpu_dig_connector;
|
||||
|
||||
@@ -192,8 +192,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
|
||||
return PTR_ERR(chunk_array);
|
||||
|
||||
p->nchunks = cs->in.num_chunks;
|
||||
p->chunks = kvmalloc_objs(struct amdgpu_cs_chunk, p->nchunks,
|
||||
GFP_KERNEL);
|
||||
p->chunks = kvmalloc_objs(struct amdgpu_cs_chunk, p->nchunks);
|
||||
if (!p->chunks) {
|
||||
ret = -ENOMEM;
|
||||
goto free_chunk;
|
||||
|
||||
@@ -1931,8 +1931,7 @@ int amdgpu_discovery_get_nps_info(struct amdgpu_device *adev,
|
||||
|
||||
switch (le16_to_cpu(nps_info->v1.header.version_major)) {
|
||||
case 1:
|
||||
mem_ranges = kvzalloc_objs(*mem_ranges, nps_info->v1.count,
|
||||
GFP_KERNEL);
|
||||
mem_ranges = kvzalloc_objs(*mem_ranges, nps_info->v1.count);
|
||||
if (!mem_ranges)
|
||||
return -ENOMEM;
|
||||
*nps_type = nps_info->v1.nps_type;
|
||||
|
||||
@@ -153,8 +153,7 @@ int amdgpu_ring_mux_init(struct amdgpu_ring_mux *mux, struct amdgpu_ring *ring,
|
||||
mux->real_ring = ring;
|
||||
mux->num_ring_entries = 0;
|
||||
|
||||
mux->ring_entry = kzalloc_objs(struct amdgpu_mux_entry, entry_size,
|
||||
GFP_KERNEL);
|
||||
mux->ring_entry = kzalloc_objs(struct amdgpu_mux_entry, entry_size);
|
||||
if (!mux->ring_entry)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -966,8 +966,7 @@ int amdgpu_virt_init_critical_region(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
/* Allocate for init_data_hdr */
|
||||
init_data_hdr = kzalloc_obj(struct amd_sriov_msg_init_data_header,
|
||||
GFP_KERNEL);
|
||||
init_data_hdr = kzalloc_obj(struct amd_sriov_msg_init_data_header);
|
||||
if (!init_data_hdr)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -2107,8 +2107,7 @@ struct amdgpu_encoder_atom_dig *
|
||||
amdgpu_atombios_encoder_get_dig_info(struct amdgpu_encoder *amdgpu_encoder)
|
||||
{
|
||||
int encoder_enum = (amdgpu_encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
|
||||
struct amdgpu_encoder_atom_dig *dig = kzalloc_obj(struct amdgpu_encoder_atom_dig,
|
||||
GFP_KERNEL);
|
||||
struct amdgpu_encoder_atom_dig *dig = kzalloc_obj(struct amdgpu_encoder_atom_dig);
|
||||
|
||||
if (!dig)
|
||||
return NULL;
|
||||
|
||||
@@ -1775,8 +1775,7 @@ static int dce_v10_0_afmt_init(struct amdgpu_device *adev)
|
||||
|
||||
/* DCE10 has audio blocks tied to DIG encoders */
|
||||
for (i = 0; i < adev->mode_info.num_dig; i++) {
|
||||
adev->mode_info.afmt[i] = kzalloc_obj(struct amdgpu_afmt,
|
||||
GFP_KERNEL);
|
||||
adev->mode_info.afmt[i] = kzalloc_obj(struct amdgpu_afmt);
|
||||
if (adev->mode_info.afmt[i]) {
|
||||
adev->mode_info.afmt[i]->offset = dig_offsets[i];
|
||||
adev->mode_info.afmt[i]->id = i;
|
||||
|
||||
@@ -1818,8 +1818,7 @@ static int dce_v6_0_afmt_init(struct amdgpu_device *adev)
|
||||
|
||||
/* DCE6 has audio blocks tied to DIG encoders */
|
||||
for (i = 0; i < adev->mode_info.num_dig; i++) {
|
||||
adev->mode_info.afmt[i] = kzalloc_obj(struct amdgpu_afmt,
|
||||
GFP_KERNEL);
|
||||
adev->mode_info.afmt[i] = kzalloc_obj(struct amdgpu_afmt);
|
||||
if (adev->mode_info.afmt[i]) {
|
||||
adev->mode_info.afmt[i]->offset = dig_offsets[i];
|
||||
adev->mode_info.afmt[i]->id = i;
|
||||
|
||||
@@ -1722,8 +1722,7 @@ static int dce_v8_0_afmt_init(struct amdgpu_device *adev)
|
||||
|
||||
/* DCE8 has audio blocks tied to DIG encoders */
|
||||
for (i = 0; i < adev->mode_info.num_dig; i++) {
|
||||
adev->mode_info.afmt[i] = kzalloc_obj(struct amdgpu_afmt,
|
||||
GFP_KERNEL);
|
||||
adev->mode_info.afmt[i] = kzalloc_obj(struct amdgpu_afmt);
|
||||
if (adev->mode_info.afmt[i]) {
|
||||
adev->mode_info.afmt[i]->offset = dig_offsets[i];
|
||||
adev->mode_info.afmt[i]->id = i;
|
||||
|
||||
@@ -1064,8 +1064,7 @@ static int gmc_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
|
||||
adev->vm_manager.vram_base_offset = 0;
|
||||
}
|
||||
|
||||
adev->gmc.vm_fault_info = kmalloc_obj(struct kfd_vm_fault_info,
|
||||
GFP_KERNEL);
|
||||
adev->gmc.vm_fault_info = kmalloc_obj(struct kfd_vm_fault_info);
|
||||
if (!adev->gmc.vm_fault_info)
|
||||
return -ENOMEM;
|
||||
atomic_set_release(&adev->gmc.vm_fault_info_updated, 0);
|
||||
|
||||
@@ -1179,8 +1179,7 @@ static int gmc_v8_0_sw_init(struct amdgpu_ip_block *ip_block)
|
||||
adev->vm_manager.vram_base_offset = 0;
|
||||
}
|
||||
|
||||
adev->gmc.vm_fault_info = kmalloc_obj(struct kfd_vm_fault_info,
|
||||
GFP_KERNEL);
|
||||
adev->gmc.vm_fault_info = kmalloc_obj(struct kfd_vm_fault_info);
|
||||
if (!adev->gmc.vm_fault_info)
|
||||
return -ENOMEM;
|
||||
atomic_set_release(&adev->gmc.vm_fault_info_updated, 0);
|
||||
|
||||
Reference in New Issue
Block a user