[PATCH] drm/amd/amdgpu: Remove redundant else branch in amdgpu_encoders.c

Alex Deucher alexdeucher at gmail.com
Mon May 8 15:56:51 UTC 2023


On Mon, May 8, 2023 at 11:29 AM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> Adhere to Linux kernel coding style.
>
> Reported by checkpatch:
>
> WARNING: else is not generally useful after a break or return
>

What about the else in the previous case statement?

Alex

> 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_encoders.c | 26 ++++++++++----------
>  1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c
> index c96e458ed088..049e9976ff34 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_encoders.c
> @@ -242,19 +242,18 @@ bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder,
>                 if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
>                     (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP))
>                         return false;
> -               else {
> -                       /* HDMI 1.3 supports up to 340 Mhz over single link */
> -                       if (connector->display_info.is_hdmi) {
> -                               if (pixel_clock > 340000)
> -                                       return true;
> -                               else
> -                                       return false;
> -                       } else {
> -                               if (pixel_clock > 165000)
> -                                       return true;
> -                               else
> -                                       return false;
> -                       }
> +
> +               /* HDMI 1.3 supports up to 340 Mhz over single link */
> +               if (connector->display_info.is_hdmi) {
> +                       if (pixel_clock > 340000)
> +                               return true;
> +                       else
> +                               return false;
> +               } else {
> +                       if (pixel_clock > 165000)
> +                               return true;
> +                       else
> +                               return false;
>                 }
>         default:
>                 return false;
> --
> 2.25.1
>


More information about the amd-gfx mailing list