From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Joe Perches <joe@perches.com>
Cc: dan.carpenter@oracle.com, Emma Anholt <emma@anholt.net>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/v3d: Use kvcalloc
Date: Sun, 13 Mar 2022 11:35:49 +0530 [thread overview]
Message-ID: <bf3cd367-81be-a72b-6f23-14005f308a1d@oracle.com> (raw)
In-Reply-To: <05dbfbd2670e2b28229d0ab96c1bd99787d4a187.camel@perches.com>
Hi Joe,
On 13/03/22 3:57 am, Joe Perches wrote:
> On Sat, 2022-03-12 at 07:26 -0800, Harshit Mogalapalli wrote:
>> kvcalloc is same as kvmalloc_array + __GFP_ZERO.
> []
>> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
> []
>> @@ -308,9 +308,8 @@ v3d_lookup_bos(struct drm_device *dev,
>> return -EINVAL;
>> }
>>
>> - job->bo = kvmalloc_array(job->bo_count,
>> - sizeof(struct drm_gem_cma_object *),
>> - GFP_KERNEL | __GFP_ZERO);
>> + job->bo = kvcalloc(job->bo_count, sizeof(struct drm_gem_cma_object *),
>> + GFP_KERNEL);
>> if (!job->bo) {
>> DRM_DEBUG("Failed to allocate validated BO pointers\n");
>> return -ENOMEM;
>
> trivia:
>
> The DRM_DEBUG could also be removed as the the alloc will do a
> a dump_stack on failure.
>
>
Thanks for sharing your comments.
DRM_DEBUG statements are present in other parts of code as well. So
didnot remove it.
Example below:
drivers/gpu/drm/v3d/v3d_gem.c at 322.
311 job->bo = kvmalloc_array(job->bo_count,
312 sizeof(struct drm_gem_cma_object *),
313 GFP_KERNEL | __GFP_ZERO);
314 if (!job->bo) {
315 DRM_DEBUG("Failed to allocate validated BO
pointers\n");
316 return -ENOMEM;
317 }
318
319 handles = kvmalloc_array(job->bo_count, sizeof(u32),
GFP_KERNEL);
320 if (!handles) {
321 ret = -ENOMEM;
322 DRM_DEBUG("Failed to allocate incoming GEM
handles\n");
323 goto fail;
324 }
Regards,
Harshit
next prev parent reply other threads:[~2022-03-13 6:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-12 15:26 [PATCH] drm/v3d: Use kvcalloc Harshit Mogalapalli
2022-03-12 22:27 ` Joe Perches
2022-03-13 6:05 ` Harshit Mogalapalli [this message]
2022-03-28 12:25 ` Melissa Wen
2022-03-29 12:01 ` Harshit Mogalapalli
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=bf3cd367-81be-a72b-6f23-14005f308a1d@oracle.com \
--to=harshit.m.mogalapalli@oracle.com \
--cc=airlied@linux.ie \
--cc=dan.carpenter@oracle.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emma@anholt.net \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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