* [PATCH drm-next] drm/amdgpu: simplify return statement in amdgpu_ras_eeprom_init
@ 2024-12-12 10:56 Dheeraj Reddy Jonnalagadda
2024-12-12 16:49 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Dheeraj Reddy Jonnalagadda @ 2024-12-12 10:56 UTC (permalink / raw)
To: airlied, simona, amd-gfx
Cc: alexander.deucher, christian.koenig, Xinhui.Pan, dri-devel,
linux-kernel, Dheeraj Reddy Jonnalagadda
Remove the logically dead code in the last return statement of
amdgpu_ras_eeprom_init. The condition res < 0 is redundant since
res is already checked for a negative value earlier. Replace
return res < 0 ? res : 0; with return 0 to improve clarity.
Fixes: 63d4c081a556 ("drm/amdgpu: Optimize EEPROM RAS table I/O")
Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602413
Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
index 0d824f016916..52c16bfeccaa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
@@ -1390,7 +1390,7 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
}
control->ras_fri = RAS_OFFSET_TO_INDEX(control, hdr->first_rec_offset);
- return res < 0 ? res : 0;
+ return 0;
}
int amdgpu_ras_eeprom_check(struct amdgpu_ras_eeprom_control *control)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH drm-next] drm/amdgpu: simplify return statement in amdgpu_ras_eeprom_init
2024-12-12 10:56 [PATCH drm-next] drm/amdgpu: simplify return statement in amdgpu_ras_eeprom_init Dheeraj Reddy Jonnalagadda
@ 2024-12-12 16:49 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2024-12-12 16:49 UTC (permalink / raw)
To: Dheeraj Reddy Jonnalagadda
Cc: airlied, simona, amd-gfx, alexander.deucher, christian.koenig,
Xinhui.Pan, dri-devel, linux-kernel
On Thu, Dec 12, 2024 at 9:18 AM Dheeraj Reddy Jonnalagadda
<dheeraj.linuxdev@gmail.com> wrote:
>
> Remove the logically dead code in the last return statement of
> amdgpu_ras_eeprom_init. The condition res < 0 is redundant since
> res is already checked for a negative value earlier. Replace
> return res < 0 ? res : 0; with return 0 to improve clarity.
>
> Fixes: 63d4c081a556 ("drm/amdgpu: Optimize EEPROM RAS table I/O")
> Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602413
> Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
Applied. thanks!
I've dropped the fixes tag however since, this is not a bug fix, it's
just removing logically dead code.
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
> index 0d824f016916..52c16bfeccaa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
> @@ -1390,7 +1390,7 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
> }
> control->ras_fri = RAS_OFFSET_TO_INDEX(control, hdr->first_rec_offset);
>
> - return res < 0 ? res : 0;
> + return 0;
> }
>
> int amdgpu_ras_eeprom_check(struct amdgpu_ras_eeprom_control *control)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-12 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 10:56 [PATCH drm-next] drm/amdgpu: simplify return statement in amdgpu_ras_eeprom_init Dheeraj Reddy Jonnalagadda
2024-12-12 16:49 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox