From nobody Wed Dec 17 16:09:49 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B855CEE49AE for ; Sun, 20 Aug 2023 09:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbjHTJ4x (ORCPT ); Sun, 20 Aug 2023 05:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbjHTJ4p (ORCPT ); Sun, 20 Aug 2023 05:56:45 -0400 Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A1A0173E for ; Sun, 20 Aug 2023 02:51:46 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id Xf5hqwKJwP8tnXf60q04iy; Sun, 20 Aug 2023 11:51:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1692525104; bh=GmGlyOuKr3DOh7EliZTmHtbJNAFzwthK3MIWxCPwYFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GD0ZWR9hTLrOkiw94GYsIjasnjD3BFeoabsOm43fC8opZyEe5XF4ueJ64eUe3WzKo StJOy8WhsIw+uKrXvawJFt7p+KUyIQl8y89LSSfDivbSrT/raG6jf2djzQWxXTyPQv ic8Euz+eVSIWbUvBgBpG7hZfhuX8QALQzCzAJDhN1wNT89gWOC8vVGjTIHgtH5DmFN tUl7HwTqt1FmN0/neMNbp0D92faBqP+cMY2oW8v2YD7+rz72/EhhBWf+1llrVHe5p9 xu0aFjJQuNuj3OCDDcWFmznxi42Sx8lszkNEQzT2f+tcSwC0VEfZ1Doo0ATNM7HcmZ stovTdiCg1ftw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 20 Aug 2023 11:51:44 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, Felix.Kuehling@amd.com, Arunpravin.PaneerSelvam@amd.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 4/4] drm/amdgpu: Use kvzalloc() to simplify code Date: Sun, 20 Aug 2023 11:51:16 +0200 Message-Id: <349dde45fa2596bb218b29166931c6a38e4b9bde.1692524665.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" kvzalloc() can be used instead of kvmalloc() + memset() + explicit NULL assignments. It is less verbose and more future proof. Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/= amd/amdgpu/amdgpu_bo_list.c index 6ea9ff22c281..6f5b641b631e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -78,17 +78,13 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, s= truct drm_file *filp, unsigned i; int r; =20 - list =3D kvmalloc(struct_size(list, entries, num_entries), GFP_KERNEL); + list =3D kvzalloc(struct_size(list, entries, num_entries), GFP_KERNEL); if (!list) return -ENOMEM; =20 kref_init(&list->refcount); - list->gds_obj =3D NULL; - list->gws_obj =3D NULL; - list->oa_obj =3D NULL; =20 array =3D list->entries; - memset(array, 0, num_entries * sizeof(struct amdgpu_bo_list_entry)); =20 for (i =3D 0; i < num_entries; ++i) { struct amdgpu_bo_list_entry *entry; --=20 2.34.1