From fe0344316184dbd04a5787bc9d50f0198b618025 Mon Sep 17 00:00:00 2001 From: Prateek sethi Date: Wed, 17 Feb 2021 14:33:01 +0530 Subject: [PATCH] gpu: nvgpu: replace hardcoded subscript with macro size of syncpt_name is hardcoded. Patch replaces hardcoded value with macro. Jira NVGPU-6371 Change-Id: I7a025f8f3687e104f61e0305096ac9e48d245a48 Signed-off-by: Prateek sethi Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2485732 (cherry picked from commit 6e373be0c5377b7c251787caa79934db9a389e70) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2493073 Tested-by: mobile promotions Reviewed-by: Alex Waterman Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c | 6 +++--- drivers/gpu/nvgpu/common/sync/channel_user_syncpt_priv.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c b/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c index 5c53fc2ba..6382e8883 100644 --- a/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c +++ b/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -68,7 +68,7 @@ nvgpu_channel_user_syncpt_create(struct nvgpu_channel *ch) { struct gk20a *g = ch->g; struct nvgpu_channel_user_syncpt *s; - char syncpt_name[32] = {0}; /* e.g. gp10b_42_user */ + char syncpt_name[SYNCPT_NAME_SZ] = {0}; /* e.g. gp10b_42_user */ int err; s = nvgpu_kzalloc(ch->g, sizeof(*s)); @@ -80,7 +80,7 @@ nvgpu_channel_user_syncpt_create(struct nvgpu_channel *ch) s->nvhost = g->nvhost; err = user_sync_build_debug_name(ch, syncpt_name, - sizeof(syncpt_name) - 1UL); + SYNCPT_NAME_SZ - 1UL); if (err < 0) { goto err_free; } diff --git a/drivers/gpu/nvgpu/common/sync/channel_user_syncpt_priv.h b/drivers/gpu/nvgpu/common/sync/channel_user_syncpt_priv.h index 0f30b50c7..2757e0105 100644 --- a/drivers/gpu/nvgpu/common/sync/channel_user_syncpt_priv.h +++ b/drivers/gpu/nvgpu/common/sync/channel_user_syncpt_priv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -37,4 +37,6 @@ struct nvgpu_channel_user_syncpt { struct nvgpu_mem syncpt_buf; }; +#define SYNCPT_NAME_SZ 32UL + #endif /* NVGPU_USER_SYNC_PRIV_H */