[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200522172736.GE29907@embeddedor>
Date: Fri, 22 May 2020 12:27:36 -0500
From: "Gustavo A. R. Silva" <gustavoars@...nel.org>
To: Christian König <christian.koenig@....com>
Cc: Alex Deucher <alexander.deucher@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: Re: [PATCH] drm/radeon/dpm: Replace one-element array and use
struct_size() helper
On Fri, May 22, 2020 at 09:00:09AM +0200, Christian König wrote:
> > +++ b/drivers/gpu/drm/radeon/ni_dpm.c
> > @@ -2685,11 +2685,12 @@ static int ni_upload_sw_state(struct radeon_device *rdev,
> > struct rv7xx_power_info *pi = rv770_get_pi(rdev);
> > u16 address = pi->state_table_start +
> > offsetof(NISLANDS_SMC_STATETABLE, driverState);
> > - u16 state_size = sizeof(NISLANDS_SMC_SWSTATE) +
> > - ((NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1) * sizeof(NISLANDS_SMC_HW_PERFORMANCE_LEVEL));
> > + NISLANDS_SMC_SWSTATE *smc_state;
> > + u16 state_size = struct_size(smc_state, levels,
> > + NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE);
>
> Probably better to use size_t instead of u16 here. With that fixed feel free
> to stick my rb on the patch.
>
Sure thing. I'll send v2, shortly.
Thanks, Christian.
--
Gustavo
Powered by blists - more mailing lists