All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Felix Kuehling <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
Cc: Kent Russell <kent.russell-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 09/19] drm/amdkfd: Remove usage of alloc(sizeof(struct...
Date: Sat, 12 Aug 2017 16:23:57 +0300	[thread overview]
Message-ID: <CAFCwf12H9D7S6_u0khjD+MfvJvyZiSD7LJQjACh0M5XYTwM89w@mail.gmail.com> (raw)
In-Reply-To: <1502488589-30272-10-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>

On Sat, Aug 12, 2017 at 12:56 AM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
> From: Kent Russell <kent.russell@amd.com>
>
> See https://kernel.org/doc/html/latest/process/coding-style.html
> under "14) Allocating Memory" for rationale behind removing the
> x=alloc(sizeof(struct) style and using x=alloc(sizeof(*x) instead
>
> Signed-off-by: Kent Russell <kent.russell@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c  |  4 ++--
>  drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c          |  2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c       |  2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c        |  2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c |  2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_queue.c                 | 10 +++++-----
>  6 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 2003a7e..68fe6ed 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -420,7 +420,7 @@ static int register_process_nocpsch(struct device_queue_manager *dqm,
>
>         BUG_ON(!dqm || !qpd);
>
> -       n = kzalloc(sizeof(struct device_process_node), GFP_KERNEL);
> +       n = kzalloc(sizeof(*n), GFP_KERNEL);
>         if (!n)
>                 return -ENOMEM;
>
> @@ -1133,7 +1133,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)
>
>         pr_debug("Loading device queue manager\n");
>
> -       dqm = kzalloc(sizeof(struct device_queue_manager), GFP_KERNEL);
> +       dqm = kzalloc(sizeof(*dqm), GFP_KERNEL);
>         if (!dqm)
>                 return NULL;
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> index 8844798..47e2e8a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> @@ -283,7 +283,7 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
>
>         BUG_ON(!dev);
>
> -       kq = kzalloc(sizeof(struct kernel_queue), GFP_KERNEL);
> +       kq = kzalloc(sizeof(*kq), GFP_KERNEL);
>         if (!kq)
>                 return NULL;
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
> index 9908227..dca4fc7 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
> @@ -406,7 +406,7 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
>         BUG_ON(!dev);
>         BUG_ON(type >= KFD_MQD_TYPE_MAX);
>
> -       mqd = kzalloc(sizeof(struct mqd_manager), GFP_KERNEL);
> +       mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
>         if (!mqd)
>                 return NULL;
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
> index 5ba3b40..aaaa87a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
> @@ -239,7 +239,7 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,
>         BUG_ON(!dev);
>         BUG_ON(type >= KFD_MQD_TYPE_MAX);
>
> -       mqd = kzalloc(sizeof(struct mqd_manager), GFP_KERNEL);
> +       mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
>         if (!mqd)
>                 return NULL;
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index 8432f5f..1d056a6 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -187,7 +187,7 @@ int pqm_create_queue(struct process_queue_manager *pqm,
>                 dev->dqm->ops.register_process(dev->dqm, &pdd->qpd);
>         }
>
> -       pqn = kzalloc(sizeof(struct process_queue_node), GFP_KERNEL);
> +       pqn = kzalloc(sizeof(*pqn), GFP_KERNEL);
>         if (!pqn) {
>                 retval = -ENOMEM;
>                 goto err_allocate_pqn;
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
> index 0ab1970..5ad9f6f 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
> @@ -65,17 +65,17 @@ void print_queue(struct queue *q)
>
>  int init_queue(struct queue **q, const struct queue_properties *properties)
>  {
> -       struct queue *tmp;
> +       struct queue *tmp_q;
>
>         BUG_ON(!q);
>
> -       tmp = kzalloc(sizeof(struct queue), GFP_KERNEL);
> -       if (!tmp)
> +       tmp_q = kzalloc(sizeof(*tmp_q), GFP_KERNEL);
> +       if (!tmp_q)
>                 return -ENOMEM;
>
> -       memcpy(&tmp->properties, properties, sizeof(struct queue_properties));
> +       memcpy(&tmp_q->properties, properties, sizeof(*properties));
>
> -       *q = tmp;
> +       *q = tmp_q;
>         return 0;
>  }
>
> --
> 2.7.4
>

This patch is:
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-08-12 13:23 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11 21:56 [PATCH 00/19] KFD fixes and cleanups Felix Kuehling
     [not found] ` <1502488589-30272-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-11 21:56   ` [PATCH 01/19] drm/amdkfd: Fix double Mutex lock order Felix Kuehling
     [not found]     ` <1502488589-30272-2-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 12:23       ` Oded Gabbay
     [not found]         ` <CAFCwf12A9Qr-HCyQFR2eDN_TEExzxHEBVK9XQ9_xuwPKErHg3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-12 19:28           ` Kuehling, Felix
2017-08-11 21:56   ` [PATCH 02/19] drm/amdkfd: Fix typo in dbgdev_wave_reset_wavefronts Felix Kuehling
     [not found]     ` <1502488589-30272-3-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 12:29       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 03/19] drm/amdkfd: Remove bogus divide-by-sizeof(uint32_t) Felix Kuehling
     [not found]     ` <1502488589-30272-4-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 12:37       ` Oded Gabbay
     [not found]         ` <CAFCwf11Bg41FNg2sChh6EZkczb6quSzxdFXoJ-qhoE8JwqgGJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-12 18:02           ` Kuehling, Felix
     [not found]             ` <DM5PR1201MB02356DFA5A4EAE4CC747F12F928E0-grEf7a3NxMBd8L2jMOIKKmrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-12 20:00               ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 04/19] drm/amdkfd: Fix allocated_queues bitmap initialization Felix Kuehling
     [not found]     ` <1502488589-30272-5-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 12:45       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 05/19] drm/amdkfd: Clean up KFD style errors and warnings Felix Kuehling
     [not found]     ` <1502488589-30272-6-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 12:46       ` Oded Gabbay
     [not found]         ` <CAFCwf13wgCm9qPk4XX5DNOx0toPmZxogpxt5zBvEKzcMd2x3tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-12 12:58           ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 06/19] drm/amdkfd: Consolidate and clean up log commands Felix Kuehling
     [not found]     ` <1502488589-30272-7-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 13:01       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 07/19] drm/amdkfd: Change x==NULL/false references to !x Felix Kuehling
     [not found]     ` <1502488589-30272-8-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 13:07       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 08/19] drm/amdkfd: Fix goto usage Felix Kuehling
     [not found]     ` <1502488589-30272-9-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 13:21       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 09/19] drm/amdkfd: Remove usage of alloc(sizeof(struct Felix Kuehling
     [not found]     ` <1502488589-30272-10-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 13:23       ` Oded Gabbay [this message]
2017-08-11 21:56   ` [PATCH 10/19] drm/amdkfd: Remove BUG_ONs for NULL pointer arguments Felix Kuehling
     [not found]     ` <1502488589-30272-11-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 14:19       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 11/19] drm/amdkfd: Fix doorbell initialization and finalization Felix Kuehling
     [not found]     ` <1502488589-30272-12-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 14:21       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 12/19] drm/amdkfd: Allocate gtt_sa_bitmap in long units Felix Kuehling
     [not found]     ` <1502488589-30272-13-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 14:26       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 13/19] drm/amdkfd: Handle remaining BUG_ONs more gracefully Felix Kuehling
     [not found]     ` <1502488589-30272-14-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 14:39       ` Oded Gabbay
     [not found]         ` <CAFCwf129vQLO5owYBQt6S-V5WcxSrO7tu+v62-HhH2eOzATS1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-12 18:37           ` Kuehling, Felix
     [not found]             ` <DM5PR1201MB0235FD5550E28485BCF31EB1928E0-grEf7a3NxMBd8L2jMOIKKmrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-13  8:48               ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 14/19] drm/amdkfd: Add more error printing to help bringup Felix Kuehling
     [not found]     ` <1502488589-30272-15-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 14:54       ` Oded Gabbay
     [not found]         ` <CAFCwf12LtX8Me-DSVvnf72eZr=UQm6sWnBoSuB2DM8jbqk3nOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-15  3:50           ` Zhao, Yong
     [not found]             ` <CY1PR1201MB109725CE39D52B9E482824FAF08D0-JBJ/M6OpXY/YBI+VM8qCl2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-15 18:39               ` Felix Kuehling
2017-08-16  1:14               ` Felix Kuehling
2017-08-11 21:56   ` [PATCH 15/19] drm/amdkfd: Clamp EOP queue size correctly on Gfx8 Felix Kuehling
     [not found]     ` <1502488589-30272-16-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 15:04       ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 16/19] drm/amdkfd: Update PM4 packet headers Felix Kuehling
     [not found]     ` <1502488589-30272-17-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-12 15:10       ` Oded Gabbay
     [not found]         ` <CAFCwf12mAxpYF0-AWA=4hJiEe093KkakUYO28-+VxV=Uo+X4Tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-12 18:16           ` Kuehling, Felix
     [not found]             ` <DM5PR1201MB023536CBDE40370D9703EBD6928E0-grEf7a3NxMBd8L2jMOIKKmrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-12 19:09               ` Bridgman, John
     [not found]                 ` <BN6PR12MB13489181F8A90932135C1CBBE88E0-/b2+HYfkarQX0pEhCR5T8QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-08-13  8:49                   ` Oded Gabbay
     [not found]                     ` <CAFCwf12edu4VXLP8UTTJk+x9uu9D1bkgO23FpiJbuz3BEreYzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-16  1:19                       ` Felix Kuehling
     [not found]                         ` <6137eb72-cb41-d65a-7863-71adf31a3506-5C7GfCeVMHo@public.gmane.org>
2017-08-16  7:37                           ` Christian König
     [not found]                             ` <4a8512a4-21df-cf48-4500-0424b08cd357-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-08-16  9:54                               ` Oded Gabbay
2017-08-16 22:31                               ` Felix Kuehling
2017-08-16 16:10                           ` Deucher, Alexander
     [not found]                             ` <BN6PR12MB16521615E13EE720D7D5FE51F7820-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-08-16 22:33                               ` Felix Kuehling
     [not found]                                 ` <0a2aee42-c1ad-c356-dbdd-812633e570bf-5C7GfCeVMHo@public.gmane.org>
2017-08-16 22:36                                   ` Deucher, Alexander
2017-08-11 21:56   ` [PATCH 17/19] drm/amdgpu: Remove hard-coded assumptions about compute pipes Felix Kuehling
     [not found]     ` <1502488589-30272-18-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-13  8:29       ` Oded Gabbay
     [not found]         ` <CAFCwf108X+f6+jehRvykPy0NPCnYa6uHjoVAXWDvoN+35h-N5A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-14 14:53           ` Felix Kuehling
     [not found]             ` <0eec4793-c9fa-4dfb-c8d7-41995d20e738-5C7GfCeVMHo@public.gmane.org>
2017-08-14 15:06               ` Oded Gabbay
2017-08-11 21:56   ` [PATCH 18/19] drm/amdgpu: Disable GFX PG on CZ Felix Kuehling
     [not found]     ` <1502488589-30272-19-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-11 23:45       ` StDenis, Tom
     [not found]         ` <DM5PR1201MB0074CE2415F056F739B6A8B7F7890-grEf7a3NxMAwZliakWjjqGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-11 23:56           ` Felix Kuehling
     [not found]             ` <b5039bc6-5be9-d8b3-c995-082a60b40490-5C7GfCeVMHo@public.gmane.org>
2017-08-12  0:08               ` StDenis, Tom
     [not found]                 ` <DM5PR1201MB0074364796DD927ADB4746A7F78E0-grEf7a3NxMAwZliakWjjqGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-12  0:40                   ` Felix Kuehling
     [not found]                     ` <1d263ee5-e1e3-aa3a-a8aa-c1fbfbcbb8ab-5C7GfCeVMHo@public.gmane.org>
2017-08-12  0:54                       ` StDenis, Tom
     [not found]                         ` <DM5PR1201MB00745120AE898231F7BAD8DFF78E0-grEf7a3NxMAwZliakWjjqGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-12  1:18                           ` Felix Kuehling
2017-08-14 15:28                       ` Deucher, Alexander
2017-08-11 21:56   ` [PATCH 19/19] drm/amd: Update MEC HQD loading code for KFD Felix Kuehling
     [not found]     ` <1502488589-30272-20-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-08-13  8:33       ` Oded Gabbay
2017-08-12 12:28   ` [PATCH 00/19] KFD fixes and cleanups Oded Gabbay
     [not found]     ` <CAFCwf10L0sMCWnPxOi=zLuXLor4X90--m-a6UnervTmEguGL9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-12 18:07       ` Kuehling, Felix
     [not found]         ` <DM5PR1201MB0235D9AA9FAEF6F2635942C8928E0-grEf7a3NxMBd8L2jMOIKKmrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-08-14 16:25           ` Deucher, Alexander
     [not found]             ` <CY4PR12MB1653ACDE8226C3E06245F8EEF78C0-rpdhrqHFk06apTa93KjAaQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-08-14 22:23               ` Felix Kuehling

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=CAFCwf12H9D7S6_u0khjD+MfvJvyZiSD7LJQjACh0M5XYTwM89w@mail.gmail.com \
    --to=oded.gabbay-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Felix.Kuehling-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=kent.russell-5C7GfCeVMHo@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.