lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2020-05-22 19:22    [W:0.022 / U:0.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site