[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230608055754.GD324119@linux.intel.com>
Date: Thu, 8 Jun 2023 07:57:54 +0200
From: Stanislaw Gruszka <stanislaw.gruszka@...ux.intel.com>
To: Marco Pagani <marpagan@...hat.com>
Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Jacek Lawrynowicz <jacek.lawrynowicz@...ux.intel.com>,
Oded Gabbay <ogabbay@...nel.org>,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] accel/ivpu: Use struct_size()
On Thu, Jun 01, 2023 at 05:58:48PM +0200, Marco Pagani wrote:
>
> On 2023-05-29 15:28, Christophe JAILLET wrote:
> > Use struct_size() instead of hand-writing it. It is less verbose, more
> > robust and more informative.
> >
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
>
> Reviewed-by: Marco Pagani <marpagan@...hat.com>
Applied to drm-misc-next
Thanks
Stanislaw
>
> > ---
> > drivers/accel/ivpu/ivpu_job.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
> > index 3c6f1e16cf2f..0a09bba8da24 100644
> > --- a/drivers/accel/ivpu/ivpu_job.c
> > +++ b/drivers/accel/ivpu/ivpu_job.c
> > @@ -289,15 +289,13 @@ ivpu_create_job(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count)
> > {
> > struct ivpu_device *vdev = file_priv->vdev;
> > struct ivpu_job *job;
> > - size_t buf_size;
> > int ret;
> >
> > ret = ivpu_rpm_get(vdev);
> > if (ret < 0)
> > return NULL;
> >
> > - buf_size = sizeof(*job) + bo_count * sizeof(struct ivpu_bo *);
> > - job = kzalloc(buf_size, GFP_KERNEL);
> > + job = kzalloc(struct_size(job, bos, bo_count), GFP_KERNEL);
> > if (!job)
> > goto err_rpm_put;
> >
>
Powered by blists - more mailing lists