From: sashiko-bot@kernel.org
To: "Lalit Shankar Chowdhury" <lalitshankarch@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: replace kcalloc() with kzalloc_objs()
Date: Sat, 19 Sep 2026 19:23:48 +0000 [thread overview]
Message-ID: <20260919192348.D0E6A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260919191432.99342-1-lalitshankarch@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] drm/amdgpu: incomplete refactoring, kcalloc still used for identical buffers
--
commit 8b9c2e12d9fb1d601e7dde3709be635bf6ad1f1b
Author: Lalit Shankar Chowdhury <lalitshankarch@gmail.com>
Subject: drm/amdgpu: replace kcalloc() with kzalloc_objs()
This commit replaces kcalloc() with kzalloc_objs() across several files
in the AMDGPU driver to simplify object allocations. The commit message
states that it is a non-functional change.
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> index 72fd3022b6062..76793a5caa701 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
[ ... ]
> @@ -202,7 +202,7 @@ static int vcn_v1_0_sw_init(struct amdgpu_ip_block *ip_block)
> r = jpeg_v1_0_sw_init(ip_block);
>
> /* Allocate memory for VCN IP Dump buffer */
> - ptr = kcalloc(adev->vcn.num_vcn_inst * reg_count, sizeof(uint32_t), GFP_KERNEL);
> + ptr = kzalloc_objs(*ptr, adev->vcn.num_vcn_inst * reg_count);
[Severity: Low]
Could we also update the identical IP dump buffer allocation in
amdgpu_vcn_reg_dump_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c?
It looks like the refactoring might be incomplete. While this file and
others (jpeg, sdma, gfx) were successfully updated to use kzalloc_objs(),
several other instances using kcalloc() for identical buffer types were missed.
For example:
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:amdgpu_vcn_reg_dump_init() {
...
adev->vcn.ip_dump = kcalloc(adev->vcn.num_vcn_inst * count,
sizeof(uint32_t), GFP_KERNEL);
...
}
Other files that still use kcalloc() include amdgpu_ras.c,
amdgpu_ras_eeprom.c, and atom.c. Does it make sense to update these
as well to ensure the memory allocation API remains consistent across
the subsystem?
> if (!ptr) {
> DRM_ERROR("Failed to allocate memory for VCN IP Dump\n");
> adev->vcn.ip_dump = NULL;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260919191432.99342-1-lalitshankarch@gmail.com?part=1
next prev parent reply other threads:[~2026-09-19 19:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 19:14 [PATCH] drm/amdgpu: replace kcalloc() with kzalloc_objs() Lalit Shankar Chowdhury
2026-09-19 19:23 ` sashiko-bot [this message]
2026-09-19 20:08 ` [PATCH v2] " Lalit Shankar Chowdhury
2026-09-21 21:53 ` Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260919192348.D0E6A1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lalitshankarch@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox