gpu: nvgpu: acr: cast sizeof assignment to u32's

MISRA 10.3 prohibits implicit assignment of objects to a narrower or
different essential type. This change addresses cases in the ACR code
where the u64 result of sizeof() is being assigned to a u32.

JIRA NVGPU-1008

Change-Id: Id4ccb0ef6c0fd9872c4e8cb7ede736e9ae326c6c
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959636
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2018-11-27 16:57:23 -05:00
committed by mobile promotions
parent 7d9d835631
commit 27eb393cc8
3 changed files with 6 additions and 5 deletions

View File

@@ -676,7 +676,7 @@ static void lsfm_init_wpr_contents(struct gk20a *g, struct ls_flcn_mgr *plsfm,
*/
while (pnode != NULL) {
/* Flush WPR header to memory*/
nvgpu_mem_wr_n(g, ucode, i * sizeof(pnode->wpr_header),
nvgpu_mem_wr_n(g, ucode, i * (u32)sizeof(pnode->wpr_header),
&pnode->wpr_header,
(u32)sizeof(pnode->wpr_header));
@@ -744,7 +744,8 @@ static void lsfm_init_wpr_contents(struct gk20a *g, struct ls_flcn_mgr *plsfm,
/* Tag the terminator WPR header with an invalid falcon ID. */
last_wpr_hdr.falcon_id = LSF_FALCON_ID_INVALID;
nvgpu_mem_wr_n(g, ucode,
plsfm->managed_flcn_cnt * sizeof(struct lsf_wpr_header),
(u32)plsfm->managed_flcn_cnt *
(u32)sizeof(struct lsf_wpr_header),
&last_wpr_hdr,
(u32)sizeof(struct lsf_wpr_header));
}
@@ -987,7 +988,7 @@ static int lsf_gen_wpr_requirements(struct gk20a *g, struct ls_flcn_mgr *plsfm)
/* Align (size bloat) and save off generic
descriptor size*/
pnode->lsb_header.bl_data_size = ALIGN(
sizeof(pnode->bl_gen_desc),
(u32)sizeof(pnode->bl_gen_desc),
LSF_BL_DATA_SIZE_ALIGNMENT);
/*Align, save off, and include the additional BL data*/

View File

@@ -1218,7 +1218,7 @@ int lsf_gen_wpr_requirements(struct gk20a *g,
/* Align (size bloat) and save off generic
descriptor size*/
pnode->lsb_header.bl_data_size = ALIGN(
sizeof(pnode->bl_gen_desc),
(u32)sizeof(pnode->bl_gen_desc),
LSF_BL_DATA_SIZE_ALIGNMENT);
/*Align, save off, and include the additional BL data*/

View File

@@ -215,7 +215,7 @@ struct lsf_lsb_header_v1 {
* Maximum WPR Header size
*/
#define LSF_WPR_HEADERS_TOTAL_SIZE_MAX \
(ALIGN_UP((sizeof(struct lsf_wpr_header_v1) * LSF_FALCON_ID_END), \
(ALIGN_UP(((u32)sizeof(struct lsf_wpr_header_v1) * LSF_FALCON_ID_END), \
LSF_WPR_HEADER_ALIGNMENT))
#define LSF_LSB_HEADER_TOTAL_SIZE_MAX (\
ALIGN_UP(sizeof(struct lsf_lsb_header_v1), LSF_LSB_HEADER_ALIGNMENT))