[PATCH] drm/amdgpu: Remove else after return in 'is_fru_eeprom_supported'

Chen, Guchun Guchun.Chen at amd.com
Mon Jul 24 07:29:21 UTC 2023


[Public]

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Srinivasan Shanmugam
> Sent: Sunday, July 23, 2023 2:38 PM
> To: Koenig, Christian <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>
> Cc: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM at amd.com>;
> amd-gfx at lists.freedesktop.org
> Subject: [PATCH] drm/amdgpu: Remove else after return in
> 'is_fru_eeprom_supported'
>
> Expressions under 'else' branch under case 'CHIP_SIENNA_CICHLID' in
> function 'is_fru_eeprom_supported' are executed whenever the expression
> in 'if' is False. Otherwise, return from case occurs. Therefore, there is no
> need in 'else', and it has been removed.
>
> Fixes the following:
>
> WARNING: else is not generally useful after a break or return
> +                               return false;
> +                       } else {
>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
> index c9f16eab0f3d..8c3ee042556a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
> @@ -83,11 +83,12 @@ static bool is_fru_eeprom_supported(struct
> amdgpu_device *adev, u32 *fru_addr)
>                       if (strnstr(atom_ctx->vbios_pn, "D603GLXE",
>                                   sizeof(atom_ctx->vbios_pn))) {
>                               return false;

We can drop the {} for above if case, as it's only a single code line.

With that fixed, this patch is:
Reviewed-by: Guchun Chen <guchun.chen at amd.com>

Regards,
Guchun
> -                     } else {
> -                             if (fru_addr)
> -                                     *fru_addr = FRU_EEPROM_MADDR_6;
> -                             return true;
>                       }
> +
> +                     if (fru_addr)
> +                             *fru_addr = FRU_EEPROM_MADDR_6;
> +                     return true;
> +
>               } else {
>                       return false;
>               }
> --
> 2.25.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 16230 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20230724/5beb4562/attachment-0001.bin>


More information about the amd-gfx mailing list