gpu: nvgpu: fix CERT-C EXP40-C issue in posix utils

Remove const from __mptr declaration to fix EXP40-C violation.

cert_exp40_c_violation: Casting pointer "__mptr" with type
 "struct nvgpu_clk_dev const *" to type "char *" allows an
 object defined with a const-qualified type to be modified
 through use of an lvalue with non-const-qualified type

Considering implementation of container_of() a const is
not required.

JIRA NVGPU-3908
JIRA NVGPU-3561

Change-Id: Ie94c3f994a962124afcda49a178a72c9b87ba7c7
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2195032
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nitin Kumbhar
2019-09-11 14:33:42 +05:30
committed by Alex Waterman
parent cfb3067893
commit 3ad11341c1

View File

@@ -256,7 +256,7 @@ static inline unsigned int nvgpu_posix_hweight64(uint64_t x)
})
#define container_of(ptr, type, member) ({ \
const typeof(((type *)0)->member) *__mptr = (ptr); \
typeof(((type *)0)->member) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); })
#define MAX_ERRNO 4095