drm/amdgpu: Use ARRAY_SIZE to get array length
Subsystems (2)
PATCH v2 1/2 drm/amdgpu: Use ARRAY_SIZE to get array length
Use ARRAY_SIZE to get array length.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -1
@@ -89,7 +89,8 @@ const char *get_ras_block_str(struct ras_common_if *ras_block)return ras_block_string[ras_block->block]; } -#define ras_block_str (_BLOCK_) (((_BLOCK_) < (sizeof(*ras_block_string)/sizeof(const char*))) ? ras_block_string[_BLOCK_] : "Out Of Range") +#define ras_block_str (_BLOCK_) \ + (((_BLOCK_) < ARRAY_SIZE(ras_block_string)) ? ras_block_string[_BLOCK_] : "Out Of Range")#define ras_err_str (i) (ras_error_string[ffs(i)])
Signature · 1 line
2.25.1
PATCH v2 2/2 drm/amdgpu: To eliminate the warning of no previous prototype for 'amdgpu_ras_block_match_default'
To eliminate the warning of no previous prototype
for 'amdgpu_ras_block_match_default'.
Fix compile warnings.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -1
@@ -869,7 +869,8 @@ static int amdgpu_ras_enable_all_features(struct amdgpu_device *adev, }/* feature ctl end */ -int amdgpu_ras_block_match_default (struct amdgpu_ras_block_object * block_obj,enum amdgpu_ras_block block) +static int amdgpu_ras_block_match_default (struct amdgpu_ras_block_object *block_obj, +enum amdgpu_ras_block block) {if (!block_obj)return -EINVAL ;
Signature · 1 line
2.25.1
RE: [PATCH V2 2/2] drm/amdgpu: To eliminate the warning of no previous prototype for 'amdgpu_ras_block_match_default'
[AMD Official Use Only]
The subject can be simplified as "fix compile warning for ras_block_match_default", with that fixed the series is:
Quoted 39 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Thursday, January 13, 2022 6:32 PM
To: [email protected]
Cc: Chai, Thomas <[email protected]>; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH V2 2/2] drm/amdgpu: To eliminate the warning of no previous prototype for 'amdgpu_ras_block_match_default'To eliminate the warning of no previous prototype for '
amdgpu_ras_block_match_default'.Fix compile warnings.
Signed-off-by yipechai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-1@@ -869,7 +869,8 @@ static int amdgpu_ras_enable_all_features(struct amdgpu_device *adev, }/* feature ctl end */ -int amdgpu_ras_block_match_default(struct amdgpu_ras_block_object* block_obj, enum amdgpu_ras_block block) +static int amdgpu_ras_block_match_default(struct amdgpu_ras_block_object *block_obj, + enum amdgpu_ras_block block) {drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-1if (!block_obj)return -EINVAL ; --2.25.1