Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1485872
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/5] drm/amdgpu: Improve determination of sizes in two functions |
| Date | 2016-09-18 19:00 +0200 |
| Message-ID | <siNBE-26i-65@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <siNrY-22E-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 18 Sep 2016 17:24:47 +0200
Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 2709ebd..96a2457 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -855,7 +855,7 @@ static void amdgpu_atombios_fini(struct amdgpu_device *adev)
static int amdgpu_atombios_init(struct amdgpu_device *adev)
{
struct card_info *atom_card_info =
- kzalloc(sizeof(struct card_info), GFP_KERNEL);
+ kzalloc(sizeof(*atom_card_info), GFP_KERNEL);
if (!atom_card_info)
return -ENOMEM;
@@ -1224,7 +1224,8 @@ static int amdgpu_early_init(struct amdgpu_device *adev)
}
adev->ip_block_status = kcalloc(adev->num_ip_blocks,
- sizeof(struct amdgpu_ip_block_status), GFP_KERNEL);
+ sizeof(*adev->ip_block_status),
+ GFP_KERNEL);
if (adev->ip_block_status == NULL)
return -ENOMEM;
--
2.10.0
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/5] drm/amdgpu: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-18 18:50 +0200
[PATCH 3/5] drm/amdgpu: Rename a jump label in amdgpu_debugfs_regs_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-18 19:00 +0200
[PATCH 4/5] drm/amdgpu: Rename a jump label in amdgpu_device_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-18 19:00 +0200
RE: [PATCH 4/5] drm/amdgpu: Rename a jump label in amdgpu_device_init() "Deucher, Alexander" <Alexander.Deucher@amd.com> - 2016-09-19 17:10 +0200
[PATCH 5/5] drm/amdgpu: Adjust checks for null pointers in nine functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-18 19:00 +0200
[PATCH 1/5] drm/amdgpu: Use kmalloc_array() in amdgpu_debugfs_gca_config_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-18 19:00 +0200
Re: [PATCH 1/5] drm/amdgpu: Use kmalloc_array() in amdgpu_debugfs_gca_config_read() Alex Deucher <alexdeucher@gmail.com> - 2016-09-19 19:30 +0200
[PATCH 2/5] drm/amdgpu: Improve determination of sizes in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-18 19:00 +0200
csiph-web